C programming printf stdio.h

In C programming <stdio.h> printf function output the data to the console.The declaration of the function is given below.

int fscanf(FILE * restrict stream ,
const char * restrict format, …);

format -The format for which the data is to be outputted.

.. -An ellipsis-it consist of variable lists that stores the data read from the stream.

Return type
int – Returns the value the number of characters transmitted, or a negative value if an output or encoding error occurred.

Note all the conversion specifier rules apply while calling the ‘printf’ function.

This function is equivalent to ‘fprintf’ with the stream ‘stdout’ iterposed before the arguments.

Code example

char st[10] ;

int ii ;

wchar_t wc ;

printf(“Enter a string , integer and a wide-character\n”);

scanf(“%s %d %lc” , st , ii , wc);

printf( “\n\nst=%s \nii=%d \nwc=%lc” , st , ii , (win_t)wc );

Code execution result,

Enter a string , integer and a wide-character
Happy   500   M


Related links

->C fprintf stdio.h

->C sprintf stdio.h

->C vsprintf stdio.h

->C fscanf stdio.h