What is the problem in this code
#include
using namespace std;
void Spiralprint(int a[][10], int r, int c)
{
int sr = 0, sc = 0, er = r - 1, ec = c - 1;
while (sr <= er and sc <= ec)
{
// 1. Print sr from sc to sc,sr++.
for (int col = sc; col <= ec; col++)
{
cout << a[sr][col] << ", ";
}
sr++;
// 2. Print ec from sr to er, ec--.
for (int row = sr; row <= er; row++)
{
cout << a[row][ec] << ", ";
}
ec--;
// 3. Print er from ec to sc, er--.
if (er > sr)
{
for (int col = ec; col >= sc; col--)
{
cout << a[er][col] << ", ";
}
er--;
}
// 4. Print sc from er to sr, sc++.
if (ec > sc)
{
for (int row = er; row >= sr; row--)
{
cout << a[row][sc] << ", ";
}
sc++;
}
}
}
int main()
{
int r, c;
cin >> r >> c;
int a[r][10];
// int val = 1;
for (int i = 0; i < r; i++)
{
for (int j = 0; j < c; j++)
{
cin>>a[i][j];
}
cout<<endl;
}
Spiralprint(a, r, c);
cout<<"END";
return 0;
}