C – Scanf 2017-08-05T18:14:21+00:00

Scanf() :

  • This function is usually used as an input statement.
  • The format string must be a text enclosed in double quotes. It contains the information for interpreting the entire data for connecting it into internal representation in memory.
    Example: integer (%d) , float (%f) , character (%c) or string (%s).
  • The argument list contains a list of variables each preceded by the address list and separated by comma.
  • The number of argument is not fixed; however corresponding to each argument there should be a format specifier. Inside the format string the number of argument should tally with the number of format specifier.

Syntax  :
scanf(“format string”, argument list);


if i is an integer and j is a floating point number, to input these two numbers we may use
scanf(“%d%f”, &i, &j);

Output :

Prev Next