Answers for "reverse array in c++ stl"

C++
2

stl function to reverse an array

reverse(ar , ar + n) ; //ar is the array , n is the size
Posted by: Guest on May-01-2021
0

reverse an array in cpp

#include<iostream>
using namespace std;
int main()
{   
     int n=3;
     int arr[]={1,2,3,4};
      while (n>=0)
    {
        cout<<arr[n];
        n--;
      }
         
    return 0;
}
Posted by: Guest on May-11-2021

Browse Popular Code Answers by Language