printf () function in C: Formatted console input and output: Syntax and Examples

printf() function has the ability to write data to the console in various formats. printf() can work on any data type like characters, integers, strings.

Syntax of printf():

int printf(const char *control_string, …);

Control string contains characters which will be printed on screen and format specifiers. These format specifiers that begin with % sign and after that format code is displayed are used to define the arguments. The number of format specifiers and arguments should be same. And they are matched in order from left to right.

For Example:

printf(“More %s”, “Process”);

prints: More Process on the screen.

Leave a Reply