fork download
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. int m[5][5] =
  7. {
  8. { 1,2,3,4,5},
  9. { 6,7,8,9,10},
  10. { 11,12,13,14,15},
  11. { 16,17,18,19,20},
  12. { 21,22,23,24,25}
  13. };
  14.  
  15. int main([[maybe_unused]] int argc,
  16. [[maybe_unused]] const char * argv[])
  17. {
  18. typedef int reduced_matrix[4][5];
  19. reduced_matrix& r = *(reduced_matrix*)(m+1);
  20.  
  21. for(int i = 0; i < 4; ++i)
  22. {
  23. for(int j = 0; j < 5; ++j)
  24. {
  25. cout << r[i][j] << " ";
  26. }
  27. cout << endl;
  28. }
  29.  
  30. }
  31.  
Success #stdin #stdout 0s 4388KB
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