Next: Formatted Input / Up: Character Input / Previous: getchar


putchar puts its character argument on the standard output (usually the screen).

The following example program converts any typed input into capital letters. To do this it applies the function toupper from the character conversion library ctype.h to each character in turn.

  #include <ctype.h>  /* For definition of toupper */
  #include <stdio.h>  /* For definition of getchar, putchar, EOF */

  {   int ch;

      while((ch = getchar()) != EOF)
Tue Jan 17 11:40:37 GMT 1995