There are three special file pointers which are defined in stdio.h:

  • stdin refers to standard input from the keyboard
  • stdout refers to standard output on the screen
  • stderr refers to the standard error device (usually the screen)

Knowing this information, we can use fprintf just like we use printf():

fprintf(stdout, "Hello world!\n");
C

is equivalent to:

printf("Hello world!\n");
C
 
© 2025  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Access Statement