fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void fun(int *arr, int r, int c)
  5. {
  6. for(int i=0;i<r;i++)
  7. {
  8. for(int j=0;j<c;j++)
  9. {
  10. cout<<*(arr + i*c + j)<<" ";
  11. }
  12. cout<<endl;
  13. }
  14. }
  15.  
  16. int main() {
  17. // your code goes here
  18.  
  19. int arr[2][2] = {{1,2},{3,4}};
  20. fun((int *)arr, 2, 2);
  21. return 0;
  22. }
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
1 2 
3 4