#include <bits/stdc++.h>
using namespace std;
int main(){
int n,i,j;
int arr[n];
cin>>n;
for (j = 0; j < n; j++) {
cin >> arr[j];
}
for (i = n+1; i >=0; i--) {
cout << arr[i] << " ";
}
}
for most of the test cases it is showing segmentation fault for the given code. How to resolve it?
The code doesn’t work for the all the test cases.
New contributor
Alisha Kabeer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1