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 / vishnu

Try this ...

#include <stdio.h>
#include <stdlib.h>

int Rev (char *s, char *b)
{
int i ;
char c ;

if (*s == '\0')
{
return 0 ;
}
c = *s ;
i = Rev (s + 1, b) ;
b[i] = c ;
return i+1 ;
}

int main ()
{
int end ;
char str[] = "Billie jean is not my lover - MJ" ;

end = Rev (str, str) ;
str[end] = '\0' ;
printf ("Now [%s]\n", str) ;
exit (0) ;
}

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are keywords c?

996


What is wrong with this declaration?

1076


How to delete a node from linked list w/o using collectons?

2741


What are the types of variables in c?

996


What is a program flowchart?

1146


What is the size of array float a(10)?

1107


Explain what is a pragma?

1016


How can I read in an object file and jump to locations in it?

1001


What is wrong with this initialization?

975


What is calloc in c?

1098


The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

3526


How is pointer initialized in c?

992


write a program to print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me...

1893


Difference between goto, long jmp() and setjmp()?

1139


What is .obj file in c?

1040