Discover the best answers at Westonci.ca, where experts share their insights and knowledge with you. Connect with a community of experts ready to help you find solutions to your questions quickly and accurately. Our platform offers a seamless experience for finding reliable answers from a network of knowledgeable professionals.

Write a recursive function stringReverse that takes a string and a starting subscript as arguments, prints the string backward and returns nothing. The function should stop processing and return when the end of the string is encountered. Note that like an array, the square brackets ( [ ] ) operator can be used to iterate through the characters in a string.

Sagot :

Answer:

void stringReverse(string s, int start){

   if(s[start]=='\0'){

       return;

   }

   else{

       stringReverse(s.substr(1,s.length()-1),start+1);

       cout<<s[start];

   }

}

Explanation: