Printf() and Scanf() in C

Printf() and Scanf() in C


C Printf And Scanf

 

C printf() function:

The printf() function is an inbuilt library function in C language, which is used for output, i.e, to print a given statement on the console. The printf() function is defined in stdio.h (header file) in C library.

Syntax:

printf(“format string”,argument_list);

  • Format string: It is a mandatory parameter which takes value as %d (integer), %c (character), %s (string), %f (float) etc.
  • Argument List: It is also a mandatory parameter which includes all the variables that are required to print.

C scanf() function:

The scanf() function is an inbuilt library function in C language, which is used for input, i.e, to  read the input data from the console. The scanf() function is also defined in stdio.h (header file) in C library.

Syntax: