What is a error in my code?

#include
using namespace std;
void display(int a[][1000],int n)
{
for(int i = 0 ; i < n ; i++)
{
for(int j = 0 ; j < n ; j++)
{
cout<<a[i][j]<<",";
}
}
cout<<“endl”;
}
void rotate(int a[][1000] , int n)
{
for(int row = 0 ; row < n ; row++)
{
int start_col = 0 ;
int end_col = n -1;
while(start_col < end_col)
{
swap(a[row][start_col] , a[end_col][row]);
start_col++;
end_col–;
}
}
for(int i = 0 ; i < n; i++)
{
for(int j = 0 ; j < n ; j++)
{
if(i < j)
{
swap(a[i][j],a[j][i]);
}
}
}
}

main()
{
int a[1000][1000];
int n;
cin>>n;
for(int i = 0 ; i < n ; i++)
{
for(int j = 0 ; j < n ; j++)
{
cin>>a[i][j];
}
}
rotate(a,n);
display(a,n);
return 0;
}

Hello @dhruvtrehan45.

Please, share your code using Online coding blocks IDE.
The way you have shared it may introduce many syntax errors to it.

STEPS:

  1. Paste it on https://ide.codingblocks.com/
  2. Save it there.
  3. Share the URL generated.

Hey @dhruvtrehan45,

Please check the output format given in the question:
Sample Input
4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
Sample Output
4 8 12 16
3 7 11 15
2 6 10 14
1 5 9 13

Correct it.

I am not getting why it is not printing please explain me

Hello @dhruvtrehan45,

I have corrected your code:

Refer to comments for better understanding.

Hope, this would help.
Give a like if you are satisfied.

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.