Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Which built-in library function can be used to match a patter from the string?

1291


Why isnt there a numbered, multi-level break statement to break out

1038


What extern c means?

995


What is ctrl c called?

1038


What are extern variables in c?

990


Find duplicates in a file containing 6 digit number (like uid) in O (n) time.

3238


How do I use strcmp?

1071


Which is better pointer or array?

1016


What is sizeof c?

1068


What is the benefit of using #define to declare a constant?

1082


Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

1078


What are the functions to open and close file in c language?

1193


What is indirection in c?

1061


What will be your course of action for a push operation?

1108


What are volatile variables in c?

933