Skip to main content

Types of standard I/O in C

Short answer

Standard I/O includes console streams stdin, stdout, stderr; formatted I/O with printf/scanf; unformatted I/O: character getchar/putchar and string fgets/puts; and file I/O through functions like fprintf, fscanf, fread, fwrite.

List different types of standard I/O used in C.

C has the following kinds of standard input/output:

  1. Console (stream) I/O through the three standard streams: stdin (keyboard, standard input), stdout (screen, standard output) and stderr (screen, standard error output).
  2. Formatted I/O: printf() and scanf() with format specifiers.
  3. Unformatted I/O: character functions getchar(), putchar(), getch(), getche(), and string functions gets(), puts(). (getch() and getche() come from <conio.h> and are not part of standard C; gets() is unsafe and was removed in C11, so fgets() is used instead.)
  4. File I/O: fprintf, fscanf, fgetc, fputc, fread, fwrite on files.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computer Programming chapter 10 questions →