fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class test
  5. {
  6. int a, b;
  7. public:
  8. void intake(int x, int y)
  9. {
  10. a = x;
  11. b = y;
  12. }
  13.  
  14. void print(int *mat)
  15. {
  16. for (int i = 0; i < a; ++i)
  17. {
  18. for (int j = 0; j < b; ++j)
  19. {
  20. cout << mat[(b*i)+j] << " ";
  21. }
  22. cout << endl;
  23. }
  24. }
  25. };
  26.  
  27. int main()
  28. {
  29. int mat[3][2] = {{2,3},{4,5},{6,7}};
  30. test arr;
  31. arr.intake(3,2);
  32. arr.print(&mat[0][0]);
  33. return 0;
  34. }
Success #stdin #stdout 0.01s 5516KB
stdin
Standard input is empty
stdout
2 3 
4 5 
6 7