fork download
  1. #include <stdio.h>
  2. unsigned char arr2D_0[2][3] = {{1,2,3},{4,5,6}};
  3. unsigned char arr2D_1[2][3] = {{7,8,9},{10,11,12}};
  4. unsigned char arr3D_0[2][2][3] = {{{1,2,3},{4,5,6}}, {{7,8,9},{10,11,12}}};
  5. unsigned char arr3D_1[2][2][3] = {{{13,14,15},{16,17,18}}, {{19,20,21},{22,23,24}}};
  6. unsigned char (*pArr2D[3])[2] = {arr2D_0, arr2D_1};
  7. unsigned char ((*pArr3D[2])[3])[2]= {arr3D_0, arr3D_1};
  8. int main(void) {
  9. // your code goes here
  10. unsigned char i, j, k, l;
  11. unsigned char (*Arr2D)[3];
  12. unsigned char (*Arr3D)[2][3];
  13.  
  14. for(i=0; i<2; i++)
  15. {
  16. printf("\n");
  17. Arr2D = pArr2D[i];
  18. for(j=0; j<2; j++)
  19. for(k=0; k<3; k++)
  20. printf("%d, ", Arr2D[j][k]);
  21. }
  22.  
  23. for(i=0; i<2; i++)
  24. {
  25. printf("\n");
  26. Arr3D = pArr3D[i];
  27. for(j=0; j<2; j++)
  28. for(k=0; k<2; k++)
  29. for(l=0; l<3; l++)
  30. printf("%d, ", Arr3D[j][k][l]);
  31. }
  32.  
  33. return 0;
  34. }
  35.  
Success #stdin #stdout 0s 2168KB
stdin
Standard input is empty
stdout
1, 2, 3, 4, 5, 6, 
7, 8, 9, 10, 11, 12, 
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,