/PASSING 2D ARRAY IN FUNCTIONS/
#include
using namespace std;
void printarray(int arr[][],int nrow,int ncol)
{
for(int i=0;i<nrow;i++)
{
for(int j=0;j<ncol;j++)
{
cout<<“Enter the elemnt of the array:\n”;
cin>>arr[i][j];
}
}
}
void waveprint(int arr[][], int nrow,int ncol)
{
for(int j=0;j<ncol;j++)
{
if(j%2==0)
{
for(int i=0;i<nrow;i++)
{
cin>>arr[i][j]<<" ";
}
}
else
{
for(int i=nrow-1;i>=0;i--)
{
cin>>arr[i][j]<<" ";
}
}
}
}
int main()
{
int nrow;
cout<<“Enter the size of row:\n”;
cin>>nrow;
int ncol;
cout<<“Enter the size of column:\n”;
cin>>ncol;
int arr[nrow][ncol];
printarray(arr,nrow,ncol);
waveprint(arr,nrow,ncol);
return 0;
}