Vidyalelo
Data Structure · Q713

Miscellaneous on Data Structures

Programming · Data Structure · question 713

Q713

Consider the following iterative implementation used to reverse a string: #include #include void reverse_string(char *s) int len = strlen(s); int i,j; i=0; j=len-1; while(______) char tmp = s[i]; s[i] = s[j]; s[j] = tmp; i++; j--; Which of the following lines should be inserted to complete the above code?

A.
i > j
B.
i < len
C.
j > 0
D.
i < j
Answer

Answer: Option D

Solution

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