Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- /* Remember 2d arrays are declared array[rows][columns] */
- #define NROW 3 /* Number of rows */
- #define NCOL 5 /* Number of columns */
- int array2d[NROW][NCOL] = {
- {1, 2, 3, 4, 5},
- {6, 7, 8, 9, 10},
- {11, 12, 13, 14, 15}
- };
- int main()
- {
- int col, row;
- printf("Printing array2d\n");
- for (row = 0; row <= NROW - 1; row++)
- {
- for (col = 0; col <= NCOL - 1; col++)
- {
- printf("%i ", array2d[row][col]);
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement