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, …);

Parameters:
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

st=Happy
ii=500
wc=M


Related links

->C programming fscanf stdio.h