fork download
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. int m[5][5] =
  6. {
  7. { 1,2,3,4,5},
  8. { 6,7,8,9,10},
  9. { 11,12,13,14,15},
  10. { 16,17,18,19,20},
  11. { 21,22,23,24,25}
  12. };
  13.  
  14. void out_matrix(int r[4][5])
  15. {
  16. for(int i = 0; i < 4; ++i)
  17. {
  18. for(int j = 0; j < 5; ++j)
  19. {
  20. printf("%2d ",r[i][j]);
  21. }
  22. puts("");
  23. }
  24. }
  25.  
  26. int main()
  27. {
  28. typedef int reduced_matrix[4][5];
  29. reduced_matrix * r = (reduced_matrix*)(m+1);
  30.  
  31. for(int i = 0; i < 4; ++i)
  32. {
  33. for(int j = 0; j < 5; ++j)
  34. {
  35. printf("%2d ",(*r)[i][j]);
  36. }
  37. puts("");
  38. }
  39. puts("----\n");
  40. out_matrix(m+1);
  41. }
  42.  
Success #stdin #stdout 0s 4340KB
stdin
Standard input is empty
stdout
 6   7   8   9  10  
11  12  13  14  15  
16  17  18  19  20  
21  22  23  24  25  
----

 6   7   8   9  10  
11  12  13  14  15  
16  17  18  19  20  
21  22  23  24  25