How to reverse a string using a recursive function, without
swapping or using an extra memory?
Answer Posted / aditi parab
#include <stdio.h>
int main ()
{
int i,j;
char a[10];
char temp;
//clrscr (); // only works on windows
gets(a);
for (i=0;a[i]!='\0';i++);
i--;
for (j=0;j <= i/2 ;j++)
{
temp = a[j];
a[j] = a[i-j];
a[i-j] = temp;
}
printf("%s",a);
return(0);
}
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Why we write conio h in c?
What are the basic data types associated with c?
Explain the ternary tree?
What does the error message "DGROUP exceeds 64K" mean?
State the difference between realloc and free.
what is the difference between class and unio?
What is the purpose of sprintf() function?
Write a function that will take in a phone number and output all possible alphabetical combinations
write a program to concatenation the string using switch case?
When was c language developed?
What is an auto keyword in c?
how is the examination pattern?
Is register a keyword in c?
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
Can we access the array using a pointer in c language?