designate.c 273 B

12345678910111213
  1. // designate.c -- use designated initializers
  2. #include <stdio.h>
  3. #define MONTHS 12
  4. int main(void)
  5. {
  6. int days[MONTHS] = {31,28, [4] = 31,30,31, [1] = 29};
  7. int i;
  8. for (i = 0; i < MONTHS; i++)
  9. printf("%2d %d\n", i + 1, days[i]);
  10. return 0;
  11. }