Waveprint question

#include
using namespace std;

int main()
{
int n,m;
cin>>m>>n;
int arr[m][n];
int row,col;

for ( col = 0; col < n; col++)
{	
	if (col%2==0)
	{
		for (row = 0; row < m; row++)
		{
			cout<<arr[m][n]<<' ';
		}
	}
	else
	{
		for (row = m-1; row >=0; row--)
		{
			cout<<arr[m][n]<<' ';
		}
	}
}	

return 0;

}
//getting output as 16

hi @srivastavaayush1611_3fd51b257da0b834 u r writing wrong index of array not a[m][n] rather a[row][col]

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.