2D array problem is not extued by g++

sir, 2d array problem of wave print is not working in g++.i have right the same code as sir did. hoe t solve this probem

@Abhishmu5 send me your code, i will check it.

#include
using namespace std;
void spiral(int a[][1000],int m, int n)
{
int startrow=0;
int startcol=0;
int endrow=m-1;
int endcol=n-1;
while(startrow<=endrow and startcol<=endcol)
{
for(int i=startcol;i<endcol;i++)
{
cout<<a[startrow][i];
}
startrow++;
for(int i=startrow;i<=endrow;i++)
{
cout<<a[i][endcol];
}
endcol–;
if(endrow>startrow)
{

			for(int i=endcol;i<=startcol;i--)
		{
			cout<<a[endrow][i];
		}
		endrow--;
	}
	if(endcol>startcol)
	{
		for(int i=endrow;i>=startrow;i--)
		{
			cout<<a[i][startcol]; 
		}
		startcol++;
	}
}

}
int main()
{
int m;
int n;
int a[1000][1000];
cin>>m;
cin>>n;
int val=1;
for (int row=0;row<m;row++)
{
for(int col=0;col<n;col++)
{
a[row][col]=val;
val=val+1;
cout<<a[row][col]<<" ";
}
cout<<endl;
}
spiral(a,m,n);
return 0;
}

@Abhishmu5 check for equality condition too inside your if conditions,
if(endrow>=startrow) and at if(endcol>=startcol)