Print Array in Reverse Order using C++
Posted by Samath
Last Updated: January 05, 2017
  330

This program use a function that takes a string and then prints it in reverse order.

#include<iostream>
using namespace std;

void func_reverse(char *); 

int main()
{
    char text[] = "Hello World";
    func_reverse(text);
    return 0;
}


void func_reverse (char *stri)
{
    int counter = 0;
    while(stri[counter] != '\0')
        counter++;
    for(int i=counter-1;i>=0;i--)
        cout<<stri[i];
    cout<<endl;
}