Get reliable answers to your questions at Westonci.ca, where our knowledgeable community is always ready to help. Explore thousands of questions and answers from knowledgeable experts in various fields on our Q&A platform. Join our Q&A platform to connect with experts dedicated to providing accurate answers to your questions in various fields.

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: