It gives me error buy why i cant understand

#include
using namespace std;
void reversearray(int a[],int n){
int temp,i;
for(i=0; i<n; i++){
i=temp;
a[i]=i;
a[i]=temp;

}
cout<<a[i]<<endl;

}
int main() {
int n;
cin>>n;
int a[n];
for(int i=0; i<n; i++){
cin>>a[n];
}
cout<<reversearray(a,n)<<endl;

return 0;

}
i want to know where i am wrong in this code

@rathidevesh906_1dcc73a061c159bb,
your function is void but u r doing cout in main, also code is wrong in the function

Inverse is Simply swapping the value of the array with the value at that index.
u can refer to the code ive commented https://ide.codingblocks.com/s/657727

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.