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

What does catch(…) mean?

1119


What is fflush c++?

1025


What do you mean by translation unit in c++?

1368


What is the difference between struct and class?

1561


Describe new operator and delete operator?

1085


why is c++ called oops? Explain

1051


What is endl?

1155


Explain "const" reference arguments in function?

1060


Does improper inheritance have a potential to wreck a project?

1156


Explain the operation of overloading of an assignment operator.

1173


How do I get good at c++ programming?

1172


Can a program run without main function?

1168


Explain the difference between using macro and inline functions?

1125


why and when we can declar member fuction as a private in the class?

2079


What is implicit pointer in c++?

1086