How to reverse a string using a recursive function, without
swapping or using an extra memory?
Answer Posted / mahesh auti
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main(void)
{
char str1[] = "Mahesh";
char str2[80], *p1, *p2;
clrscr();
p1 = str1 + strlen(str1) - 1;
p2 = str2;
while(p1 >= str1)
*p2++ = *p1--;
*p2 = '\0';
printf("%s %s", str1, str2);
getch();
return 0;
}
| Is This Answer Correct ? | 26 Yes | 25 No |
Post New Answer View All Answers
What is a volatile keyword in c?
Why we use stdio h in c?
What is I ++ in c programming?
Write a c program to demonstrate character and string constants?
What is non linear data structure in c?
Why clrscr is used after variable declaration?
What is the scope of an external variable in c?
Explain what is a pragma?
Explain the process of converting a Tree into a Binary Tree.
What is typedef example?
What are keywords c?
How can I change the size of the dynamically allocated array?
what is the diffrenet bettwen HTTP and internet protocol
What are the different properties of variable number of arguments?
What does a pointer variable always consist of?