Guest User

Untitled

a guest
Jul 4th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4.  
  5. void func(int **arr, int row, int col)
  6. {
  7. for (int i=0; i<row; i++)
  8. {
  9. for(int j=0 ; j<col; j++)
  10. {
  11. cout<<arr[i][j]<<" ";
  12. }
  13. printf("\n");
  14. }
  15. }
  16.  
  17.  
  18. int main()
  19. {
  20. int row=2, colum=3;
  21.  
  22.  
  23.  
  24. int** arr = new int*[row];
  25.  
  26. for(int i=0; i<row; i++)
  27. {
  28. arr[i] = new int[colum];
  29. }
  30. int k=1;
  31. for(int i=0;i<row;i++)
  32. {
  33.   for(int j=0;j<colum;j++)
  34.   {
  35.     arr[i][j] = k;
  36.     k++;
  37.   }
  38. }
  39. func(arr, row, colum);
  40.  
  41. return 0;
  42.  
  43. }
Add Comment
Please, Sign In to add comment