Code not working in my visual studio

#include
using namespace std;

void spiralPrint(int a[1000][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--;

for (int i = endCol; i >= startCol; i--)
{
    cout << a[endRow][i]<<" ";

}
endRow--;

for (int i = endRow; i >= startRow; i--)
{
    cout << [i][startCol]<<" ";
}
startCol++;

}

}

int main()
{
int m, n;
int arr[1000][1000];
int val = 1;

cin >> m >> n;

for (int i = 0; i < m; i++)
{
    for (int j = 0; j < n; j++)
    {
        arr[i][j] = val;
        val = val + 1;
        cout << arr[i][j] << " ";
    }
    cout << endl;

}

spiralPrint(arr, m, n);

return 0;

}