C++ Program to print array reverse

Simple C++ program to print array reverse:
 
/* C++ Program to print reverse array */
#include<iostream>
using namespace std;
int main()
{
 int arr[]={4,2,9,4,11,3,12};
 int i,n=sizeof(arr)/sizeof(arr[0]);
 i=n;
 cout<<"Reverse array: "<<endl;
 for(i=n-1;i>=0;i--)
 {
  cout<<arr[i]<<" ";
 }
 cout<<endl;
 return 0;
}
/* End of the array */
 


Popular posts from this blog