#include<stdio.h>
#include<string.h>
void recursive_reverse_string(char *s, int left, int right)
{
if(left < right)
{
char tmp = s[left];
s[left] = s[right];
s[right] = tmp;
recursive_reverse_string(s, left+1, right-1);
}
}
int main()
{
char s[100] = "madam";
int len = strlen(s);
recursive_reverse_string(s,0,len-1);
printf("%s",s);
return 0;
}
a) 3
b) 4
c) 5
d) 6
How many times is the function recursive_reverse_string() called when the following code is executed?
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
How many times is the function recursive_reverse_string() called when the following code is executed?
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!