How to reverse a string using a recursive function, without
swapping or using an extra memory?
Answer Posted / mahendra aseri
Reverse a string
void ReverseString (char *String)
{
char *Begin = String;
char *End = String + strlen(String) - 1;
char TempChar = '\0';
while (Begin < End)
{
TempChar = *Begin;
*Begin = *End;
*End = TempChar;
Begin++;
End--;
}
}
| Is This Answer Correct ? | 24 Yes | 27 No |
Post New Answer View All Answers
write a c program in such a way that if we enter the today date the output should be next day's date.
What is pointer in c?
What is difference between stdio h and conio h?
Is c procedural or functional?
What is a good way to implement complex numbers in c?
Why do we use main function?
What are lookup tables in c?
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.
What is sorting in c plus plus?
Write a program to reverse a string.
main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above
How to create struct variables?
What is the scope of global variable in c?
What are the 4 data types?
Do pointers need to be initialized?