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
What are register variables in c?
What are the 5 types of organizational structures?
The __________ attribute is used to announce variables based on definitions of columns in a table?
Is a house a shell structure?
Why void is used in c?
‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .
Explain main function in c?
Create a simple code fragment that will swap the values of two variables num1 and num2.
Explain enumerated types in c language?
Give me the code of in-order recursive and non-recursive.
how to construct a simulator keeping the logical boolean gates in c
Is it cc or c in a letter?
find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }
Explain how can a program be made to print the line number where an error occurs?
Which type of language is c?