Rotate Image Array Problem

It shows an error on calling the rotateArray function,
My code:
#include
using namespace std;

void swap(inta,intb){
int temp=*a;
*a=*b;
*b=temp;
}

void rotateArray(int arr[][1000], int n){
for(int i=0; i<n; i++){
int start=0;
int e=n-1;
while(start<e){
swap(arr[i][start],arr[i][e]);
start++;
e–;
}
}
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
cout<<arr[j][i];
}
}
}

int main(){
int n;
cin>>n;
int arr[n][n];
for(int i = 0 ; i < n ; i++){
for(int j = 0 ; j < n ; j++){
cin>>arr[i][j];
}
}
rotateArray(arr, n);
return 0;
}

hello @gptradhika1208
pls save ur code here ->https://ide.codingblocks.com/
and share the link with me

@gptradhika1208
image

declare ur array inside main function as >
int arr[1000][1000];

Yes that worked. But how does that make a difference?

when we send 2d array to some function then column number of 2d array should be shame as column number in declaration of function.

read about how to pass 2d array in function

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.