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 the 5 types of inheritance in c ++?
How can I use a preprocessorif expression to ?
Can a variable be both constant and volatile?
How is a macro different from a function?
A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers
How do shell structures work?
2) Write a program that will help Air Traffic Control for an airport to view the sequence of flights ready for take-off. The airport can accommodate 10 flights waiting for take-off at any point in time. Each flight has a unique 3 digit numeric identifier. Each time a flight takes-off, Air Traffic Control adds a flight to the waitlist. Each time a flight is added to the waitlist, the list of flights waiting to take-off must be displayed. When a flight is cleared for take-off, Air Traffic Control removes the flight from the waitlist. Each time a flight takes-off, the list of flights waiting to take-off must be displayed. Sequence of take-off is the sequence of addition to the waitlist
What is graph in c?
How many types of sorting are there in c?
What is %g in c?
Which is better pointer or array?
How do you redirect a standard stream?
Do pointers take up memory?
how to introdu5ce my self in serco
What is a good way to implement complex numbers in c?