home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / ctutor2.zip / BIGARRAY.C < prev    next >
Text File  |  1989-11-10  |  904b  |  45 lines

  1.                                          /* Chapter 7 - Program 4 */
  2. #include "stdio.h"
  3.  
  4. char name1[] = "First Program Title";
  5.  
  6. void main()
  7. {
  8. int index;
  9. int stuff[12];
  10. float weird[12];
  11. static char name2[] = "Second Program Title";
  12.  
  13.    for (index = 0;index < 12;index++) {
  14.       stuff[index] = index + 10;
  15.       weird[index] = 12.0 * (index + 7);
  16.    }
  17.  
  18.    printf("%s\n",name1);
  19.    printf("%s\n\n",name2);
  20.    for (index = 0;index < 12;index++)
  21.       printf("%5d %5d %10.3f\n",index,stuff[index],weird[index]);
  22. }
  23.  
  24.  
  25.  
  26. /* Result of execution
  27.  
  28. First program title
  29. Second program title
  30.  
  31.     0    10     84.000
  32.     1    11     96.000
  33.     2    12    108.000
  34.     3    13    120.000
  35.     4    14    132.000
  36.     5    15    144.000
  37.     6    16    156.000
  38.     7    17    168.000
  39.     8    18    180.000
  40.     9    19    192.000
  41.    10    20    204.000
  42.    11    21    216.000
  43.  
  44. */
  45.