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

/*
reverse string between start and end indexes of a string
*/

void reverse( char* str, int start, int end )
{
if( str && ( start < end ) )
{
*( str + start ) ^= *( str + end ) ^= *( str + start )
^= *( str + end ) ;
reverse( str, ++start, --end );
}
}

int main()
{
char sample[] = "My String!";
reverse( str, 0, strlen( sample )-1 )
}

Is This Answer Correct ?    15 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Distinguish between actual and formal arguments.

1087


What is array of structure in c programming?

1292


printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions

1162


Difference between MAC vs. IP Addressing

1154


Is null equal to 0 in sql?

1152


Difference between malloc() and calloc() function?

1210


what is the basis for selection of arrays or pointers as data structure in a program

4309


The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none

1246


#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }

1160


Array is an lvalue or not?

1130


What is #include cctype?

1126


a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler

1081


What is meant by gets in c?

1193


How can a program be made to print the line number where an error occurs?

1089


What are the types of assignment statements?

1069