Category : array-reverse

I am working on an array problem in which I have to reverse an array. I wrote this code but it is not working: #include<iostream> using namespace std; void rev(int reversed_array[], int arr[], int n) { for(int i=0;i<n;i++) { reversed_array[i]=arr[i]; } } int main() { int arr[]={11,2,3,4,5}; int n; n= sizeof(arr)/sizeof(arr[0]); int reversed_array[n]; rev(reversed_array,arr,n); cout<<reversed_array[0]; ..

Read more