fork download
  1. #include <stdio.h>
  2.  
  3.  
  4. int main(int argc, const char * argv[])
  5. {
  6. double array[5][5] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25};
  7. double * p = (double*)array;
  8. for(int i = 0; i < 5; ++i)
  9. {
  10. for(int j = 0; j < 5; ++j) printf("%lf ",array[i][j]);
  11. puts("");
  12. }
  13.  
  14. for(int i = 0; i < 5; ++i)
  15. {
  16. for(int j = 0; j < 5; ++j) printf("%lf ",*(p+5*i+j));
  17. puts("");
  18. }
  19.  
  20. }
  21.  
  22.  
Success #stdin #stdout 0s 5476KB
stdin
Standard input is empty
stdout
1.000000 2.000000 3.000000 4.000000 5.000000 
6.000000 7.000000 8.000000 9.000000 10.000000 
11.000000 12.000000 13.000000 14.000000 15.000000 
16.000000 17.000000 18.000000 19.000000 20.000000 
21.000000 22.000000 23.000000 24.000000 25.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
6.000000 7.000000 8.000000 9.000000 10.000000 
11.000000 12.000000 13.000000 14.000000 15.000000 
16.000000 17.000000 18.000000 19.000000 20.000000 
21.000000 22.000000 23.000000 24.000000 25.000000