Section -2d arrays topic -spiral print

below mentioned code is working well in online ide but not in my local machine while other codes are working well.

#include
using namespace std;

void spiral_print(int arr[][1000], int m, int n)
{
int start_row = 0;
int end_row = m - 1;
int start_col = 0;
int end_col = n - 1;

while (start_row <= end_row && start_col <= end_col)
{
	//First row
	for (int col = start_col; col <= end_col; col++)
	{
		cout << arr[start_row][col] << " ";
	}
	start_row++;

	//End Column
	for (int row = start_row; row <= end_row; row++)
	{
		cout << arr[row][end_col] << " ";
	}
	end_col--;

	//End row
	for (int col = end_col; col >= start_col; col--)
	{
		cout << arr[end_row][col] << " ";
	}
	end_row--;

	//Start Column
	for (int row = end_row; row >= start_row; row--)
	{
		cout << arr[row][start_col] << " ";
	}
	start_col++;
}

}

int main()
{
#ifndef ONLINE_JUDGE
freopen(“input.txt”, “r”, stdin);
freopen(“output.txt”, “w”, stdout);
#endif

int m, n;
cin >> m >> n;

int arr[1000][1000];

int val = 1;

for (int row = 0; row < m; row++)
{
	for (int col = 0; col < n; col++)
	{
		arr[row][col] = val;
		val++;
	}
}

spiral_print(arr, m, n);

return 0;

}

#ifndef ONLINE_JUDGE
freopen(“input.txt”, “r”, stdin);
freopen(“output.txt”, “w”, stdout);
#endif
Remove this part and try…

Hey, if u still face any difficulty refer my code -->

Is there anything else??

i am checking just now.i will let you know if there will be any dificulty.

Okay @todeepakkumar1911_bbed4acf319b38dd

Thanks! problem is solved

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.