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
What is the use of f in c?
How will you declare an array of three function pointers where each function receives two ints and returns a float?
Can include files be nested?
What are dangling pointers? How are dangling pointers different from memory leaks?
What is scanf () in c?
Is void a keyword in c?
#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }
Do character constants represent numerical values?
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above
What are the 5 data types?
Why is c still so popular?
Who is the founder of c language?
write a program to find out prime number using sieve case?
why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???
which is an algorithm for sorting in a growing Lexicographic order