home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c021 / 7.img / EXAMPLES.ZIP / INTRO26.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-04  |  596 b   |  28 lines

  1. /* INTRO26.C--Example from Chapter 4 of Getting Started */
  2.  
  3. #include <stdio.h>
  4.  
  5. int main()
  6. {
  7.    float hours[52];
  8.    int week;
  9.  
  10.    /* Initialize the array */
  11.    for (week = 0; week < 52; week++)
  12.       hours[week] = 0;
  13.  
  14.    /* Store four values in array */
  15.    hours[0] = 32.5;
  16.    hours[1] = 44.0;
  17.    hours[2] = 40.5;
  18.    hours[3] = 38.0;
  19.  
  20.    /* Retrieve values and show their addresses */
  21.    printf("Elements\t\tValue\tAddress\n");
  22.    for (week = 0; week < 4; week++)
  23.       printf("hours[%d]\t\t%3.1f\t%p\n", week, hours[week],
  24.              &hours[week]);
  25.  
  26.    return 0;
  27. }
  28.