Table of Contents

cscanf

int cscanf(char *format[, address, ...]); 

description of cscanf

reads input from the console and reformat it.

cscanf reads directly from the console of a series of input fields one character at.
Then each field is formatted according to the format specifier is passed cscanf in the format designated by the pointer format string.
Finally stores cscanf formatted input to the direction indicated by the argument address memory address and shows the input on the screen.
There must be as many format specifiers and addresses given as input fields.

#include <conio.h>
int main(void)
{
    char string[80];
    clrscr();
    cprintf("Enter a string :");
    cscanf("%s", string);
    cprintf("\r\nyour string: %s", string);
    return 0;
}

output of cscanf c example

  Enter a string : 42theanswerismypadavan
  your string: 42theanswerismypadavan