fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. template <size_t n> void print(int (&a)[n][n])
  6. {
  7. for (size_t q=0; q<n; ++q)
  8. {
  9. for (size_t w=0; w<n; ++w)
  10. cout << a[q][w] << ' ';
  11.  
  12. cout << endl;
  13. }
  14.  
  15. cout << endl;
  16. }
  17.  
  18. int main()
  19. {
  20. int a[][2] = {{1,2}, {3,4}};
  21. int b[][3] = {{1,2,3}, {4,5,6}, {7,8,9}};
  22.  
  23. print(a);
  24. print(b);
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0.06s 3796KB
stdin
Standard input is empty
stdout
1 2 
3 4 

1 2 3 
4 5 6 
7 8 9