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
Write a program to check palindrome number in c programming?
Can we access array using pointer in c language?
What is the acronym for ansi?
Explain what is the difference between #include and #include 'file' ?
What is logical error?
Is a house a shell structure?
What is c standard library?
What is main () in c language?
Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.
What is Dynamic memory allocation in C? Name the dynamic allocation functions.
What does & mean in scanf?
Is c procedural or functional?
What are enums in c?
What is the difference between far and near ?
How can I manipulate strings of multibyte characters?