The function prototype for printf() and fprintf() are as follows:
int prinft( const char* format , ... );
int fprintf( FILE* stream , const char* format , ... );
Spaces have been added to emphasize the common parts of each function. We can see the console output with printf(), as follows:
int myAge = 1;
printf( "Hello, World! I am %d today!\n" , myAge );
This is, in fact, a shorthand form of the fprintf() function using stdout for the file stream parameter, as follows:
int myAge = 1;
fprintf( stdout , "Hello, World! I am %d today!\n" , myAge );
If you are so inclined, you could replace every printf( … ) statement in every program we have seen so far with its equivalent form, fprintf( stdout , … ), and all the programs would execute exactly as before. But please don't bother doing this; we have better things to do!
...