text: Print reverse of a string using recursion | C ++ program to reverse a string using recursion ; Function to print reverse of the passed string ; Driver program to test above function
code: #include <bits/stdc++.h> NEW_LINE using namespace std ; void reverse ( string str ) { if ( str . size ( ) == 0 ) { return ; } reverse ( str . substr ( 1 ) ) ; cout << str [ 0 ] ; } int main ( ) { string a = " Geeks ▁ for ▁ Geeks " ; reverse ( a ) ; return 0 ; }