38_multiple_array_index.c 432 B

123456789101112131415161718192021222324252627282930313233
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int a[4][4];
  5. int b = 0;
  6. int x;
  7. int y;
  8. for (x = 0; x < 4; x++)
  9. {
  10. for (y = 0; y < 4; y++)
  11. {
  12. b++;
  13. a[x][y] = b;
  14. }
  15. }
  16. for (x = 0; x < 4; x++)
  17. {
  18. printf("x=%d: ", x);
  19. for (y = 0; y < 4; y++)
  20. {
  21. printf("%d ", a[x][y]);
  22. }
  23. printf("\n");
  24. }
  25. return 0;
  26. }
  27. /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/