Vidyalelo
Data Structure · Q471

Miscellaneous on Data Structures

Programming · Data Structure · question 471

Q471

What is the output of the following code? #include #include void reverse_string(char *s) int len = strlen(s); int i,j; i=0; j=len-1; while(i < j) char tmp = s[i]; s[i] = s[j]; s[j] = tmp; i++; j--; int main() char s[100] = "rotator"; char t[100]; strcpy(t,s); reverse_string(s); if(strcmp(t,s) == 0) printf("Yes"); else printf("No"); return 0;

A.
Yes
Answer
B.
No
C.
Runtime error
D.
Compile time error

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board