Reverse an Array
Lesson 15 of 26 in Coddy's Arrays in C++ course.
Challenge
EasyGiven an Array, print all the elements in reverse order separated by space.
For Example, if:
int arr[]={1,2,3};Then the output should be:
3 2 1Try it yourself
#include<iostream>
using namespace std;
int main(){
int n;
cin >> n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
//Write your code here
return 0;
}
All lessons in Arrays in C++
7Array Challenges
Reverse an ArraySmallest Positive MissingTranspose of MatrixAddition of Two MatrixMax and Min ElementCheck Palindrome2Memory Analysis
Memory Allocation