Reverse a String (Recursive) C++

C++Server Side ProgrammingProgramming

Recursion is simply the way toward rehashing things in a self-comparative way. In programming dialects, if a program enables you to call a capacity inside a similar capacity, at that point, it is known as a recursive call of the capacity. You can switch a string utilizing the recursive capacity as appeared in the accompanying project.


 Live Demo

#include <bits/stdc++.h>
using namespace std;
void reverse(string str){
   if(str.size() == 0){
   cout << str[0];
int main(){
   string a = "Arnold";
   cout<<"recursive reverse (Arnold) ::";
   return 0;


The above C++ program accepts a string "Arnold" as an input then it yields results as "dlonrA" by applying recursion as;

Recursive reverse (Arnold):: dlonrA
Updated on 23-Dec-2019 06:30:31