Examveda

Consider the following recursive implementation used to reverse a string:
void recursive_reverse_string(char *s, int left, int right)
{
     if(left < right)
     {
         char tmp = s[left];
         s[left] = s[right];
         s[right] = tmp;
         _________;
     }
}
Which of the following lines should be inserted to complete the above code?

A. recursive_reverse_string(s, left+1, right+1)

B. recursive_reverse_string(s, left-1, right-1)

C. recursive_reverse_string(s, left+1, right-1)

D. recursive_reverse_string(s, left-1, right+1)

Answer: Option C


This Question Belongs to Data Structure >> Miscellaneous On Data Structures

Join The Discussion

Related Questions on Miscellaneous on Data Structures