How to reverse a string using a recursive function, without
swapping or using an extra memory?
Answer Posted / vinay tiwari
void reverse(char *,int b);
void main()
{
char a[26];
int len;
clrscr();
printf("enter string ");
gets(a);
len=strlen(a);
reverse(a,len);
getch();
}
void reverse(char * a,int len)
{
if(len==0)
printf("%c",a[len]);
else
{
printf("%c",a[len]);
reverse(a,len-1);
}
}
| Is This Answer Correct ? | 177 Yes | 62 No |
Post New Answer View All Answers
c language interview questions & answer
what is event driven software and what is procedural driven software?
What language is lisp written in?
What is meant by int main ()?
How to declare pointer variables?
What is the difference between class and object in c?
Explain the difference between malloc() and calloc() in c?
Did c have any year 2000 problems?
What is hashing in c?
What are the application of c?
why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above
Can you please explain the difference between malloc() and calloc() function?
What is function definition in c?
any "C" function by default returns an a) int value b) float value c) char value d) a & b
How do you determine the length of a string value that was stored in a variable?