home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / tyc / list10_6.c < prev    next >
C/C++ Source or Header  |  1993-10-16  |  516b  |  23 lines

  1.  /* Demonstrates using the gets() return value. */
  2.  
  3.  #include <stdio.h>
  4.  
  5.  /* Declare a character array to hold input, and a pointer. */
  6.  
  7.  char input[81], *ptr;
  8.  
  9.  main()
  10.  {
  11.      /* Display instructions. */
  12.  
  13.      puts("Enter text a line at a time, then press Enter.");
  14.      puts("Enter a blank line when done.");
  15.  
  16.      /* Loop as long as input is not a blank line. */
  17.  
  18.      while ( *(ptr = gets(input)) != NULL)
  19.          printf("You entered %s\n", input);
  20.  
  21.      puts("Thank you and goodbye");
  22.  }
  23.