fork download
  1. #include <stdio.h>
  2.  
  3. int main (int argc, char *argv[])
  4. {
  5.  
  6. int a[3][4] = {{1, 2, 3, 4},
  7. {5, 6, 7, 8},
  8. {9, 10, 11, 12}};
  9. int i, j;
  10. const int *p = (int *) a;
  11. int x;
  12.  
  13. for (i = 0; i < 3; i++)
  14. {
  15. for (j = 0; j < 4; j++)
  16. {
  17. x = *(p + i * 4 + j);
  18. //
  19. printf ("a[%i][%i]=%i\t", i, j, x);
  20. //
  21. }
  22. printf ("\n");
  23. }
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0.01s 1720KB
stdin
Standard input is empty
stdout
a[0][0]=1	a[0][1]=2	a[0][2]=3	a[0][3]=4	
a[1][0]=5	a[1][1]=6	a[1][2]=7	a[1][3]=8	
a[2][0]=9	a[2][1]=10	a[2][2]=11	a[2][3]=12