2 Friends in C: printf and scanf functions
Hi, The left over topics from previous post were: printf() scanf() escape sequences format specifiers In this post I will give you introduction to printf() and scanf() functions. There is a separate post for escape sequences and format specifier list. The printf( ) function: The printf() function is used to print formatted string on the standard console. The general syntax of printf() function is as follows: 1 2 3 4 printf ( " <formatted string> " , < list of variables > ); printf( "%d" , < integer_variable > ); printf( "%f" , < float_variable > ); printf( "%c" , < char_variable > ); Line 1 shows the generic syntax of printf() function where " <formatted string> " should be replaced by actual string to be printed on console along with the values of variables in format specifier form. Line 2,3 and 4 have format specifiers for integer, float and character variabl...