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

  1.  /* Using putchar() to display strings. */
  2.  
  3.  #include <stdio.h>
  4.  
  5.  #define MAXSTRING 80
  6.  
  7.  char message[] = "Displayed with putchar().";
  8.  main()
  9.  {
  10.      int count;
  11.  
  12.      for (count = 0; count < MAXSTRING; count++)
  13.      {
  14.  
  15.          /* Look for the end of the string. When it's found, */
  16.          /* write a newline character and exit the loop. */
  17.  
  18.          if (message[count] == '\0')
  19.          {
  20.              putchar('\n');
  21.              break;
  22.          }
  23.          else
  24.  
  25.          /* If end of string not found, write the next character. */
  26.  
  27.              putchar(message[count]);
  28.      }
  29.  }
  30.