home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 98.img / LCNOW2.ZIP / EXAMPLES / ALPHA.C < prev    next >
C/C++ Source or Header  |  1988-06-25  |  602b  |  34 lines

  1. /*
  2.  * A L P H A
  3.  *
  4.  * Create an integer array that holds the ASCII codes
  5.  * for the letters of the alphabet.  Then print out
  6.  * the contents of the array in numeric order.
  7.  */
  8.  
  9. #include <stdio.h>
  10.  
  11. #define NLETTERS 26
  12.  
  13. int
  14. main(void)
  15. {
  16.     int alpha[NLETTERS];
  17.     int i, length;
  18.  
  19.     /*
  20.      * Assign values to the array.  This loop assigns
  21.      * the letters of the alphabet to the array.
  22.      */
  23.     for (i = 0; i < NLETTERS; ++i)
  24.         alpha[i] = i + 'A';
  25.     /*
  26.      * Print out the contents of the array.
  27.      */
  28.     for (i = 0; i < NLETTERS; ++i)
  29.         putchar(alpha[i]);
  30.     putchar('\n');
  31.  
  32.     return (0);
  33. }
  34.