Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. /* Remember 2d arrays are declared array[rows][columns] */
  5.  
  6. #define NROW 3 /* Number of rows */
  7. #define NCOL 5 /* Number of columns */
  8.  
  9. int array2d[NROW][NCOL] = {
  10.                     {1, 2, 3, 4, 5},
  11.                     {6, 7, 8, 9, 10},
  12.                     {11, 12, 13, 14, 15}
  13.                     };
  14.  
  15. int main()
  16. {
  17.     int col, row;
  18.     printf("Printing array2d\n");
  19.  
  20.     for (row = 0; row <= NROW - 1; row++)
  21.         {
  22.             for (col = 0; col <= NCOL - 1; col++)
  23.                 {
  24.                     printf("%i ", array2d[row][col]);
  25.                 }
  26.             printf("\n");
  27.         }
  28.     return 0;
  29. }