home *** CD-ROM | disk | FTP | other *** search
/ C by Discovery (4th Edition) / C_By_Discovery_4th_Edition.tar / C_By_Discovery_4th_Edition / _DISK_ / ch2 / inout2.c < prev    next >
C/C++ Source or Header  |  2005-06-16  |  558b  |  21 lines

  1. /*                         inout2.c
  2.  *
  3.  *   Synopsis  - Takes input from the keyboard and echoes that
  4.  *               input back to the terminal.
  5.  *
  6.  *   Objective - Illustrates the use of an assignment statement
  7.  *               as part of the test expression in a while loop.
  8.  */
  9.  
  10. /* Include Files */
  11. #include <stdio.h>
  12.  
  13. int main( void )
  14. {
  15.      int iochar;                              /* Note 1 */
  16.  
  17.      while ( ( iochar = getchar() ) != EOF )  /* Note 2 */
  18.           putchar( iochar );                  /* Note 3 */
  19.      return 0;
  20. }
  21.