Run ❯
Get your
own
website
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
#include
int main() { // A 3D array with 2 blocks, each with 4 rows and 3 columns int example[2][4][3] = { { {1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12} }, { {13, 14, 15}, {16, 17, 18}, {19, 20, 21}, {22, 23, 24} } }; // Print all elements using 3 nested loops for (int i = 0; i < 2; i++) { printf("Block %d:\n", i + 1); for (int j = 0; j < 4; j++) { for (int k = 0; k < 3; k++) { printf("%d ", example[i][j][k]); } printf("\n"); } printf("\n"); } return 0; }
Block 1: 1 2 3 4 5 6 7 8 9 10 11 12 Block 2: 13 14 15 16 17 18 19 20 21 22 23 24