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
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
Why is c so powerful?
C program to find all possible outcomes of a dice?
What are the advantages of using new operator as compared to the function malloc ()?
What is typedef example?
Explain how can I prevent another program from modifying part of a file that I am modifying?
What are the 4 types of organizational structures?
how to introdu5ce my self in serco
What are enumerated types?
What is the method to save data in stack data structure type?
Where local variables are stored in c?
praagnovation
What is void main () in c?
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }
Write programs for String Reversal & Palindrome check