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 swap two strings without using any third variable ?

Answer Posted / rohit kapade

bool SwapString(char **s1,char **s2)
{
//char *temp = NULL;
//temp = *s1;
//*s1 = *s2;
//*s2 = temp;
*s1 = (char*)((int)*s1 + (int)*s2);
*s2 = (char*)((int)*s1 - (int)*s2);
*s1 = (char*)((int)*s1 - (int)*s2);
return true;
}

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Should the member functions which are made public in the base class be hidden?

975


What is a forward referencing and when should it be used?

1110


On throwing an exception by the animal constructor in p = new animalq, can memory leak occur?

1084


Evaulate: 22%5 a) 2 b) 4 c) 0

1040


Should I learn c++ c?

1006


What is a rooted hierarchy?

1111


Can I make ios apps with c++?

996


What is ifstream c++?

988


What is the best way to take screenshots of a window with c++ in windows?

1007


Is nan a c++?

1102


What are the various storage classes in C++?

1101


How many characters are recognized by ANSI C++?

1365


In c++, what is the difference between method overloading and method overriding?

1083


What is buffering in c++?

1022


Why would you use pointers in c++?

1103