1
0

day_mon2.c 338 B

12345678910111213
  1. /* day_mon2.c -- letting the compiler count elements */
  2. #include <stdio.h>
  3. int main(void)
  4. {
  5. const int days[] = {31,28,31,30,31,30,31,31,30,31};
  6. int index;
  7. for (index = 0; index < sizeof days / sizeof days[0]; index++)
  8. printf("Month %2d has %d days.\n", index +1,
  9. days[index]);
  10. return 0;
  11. }