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 / santosh panigrahy

int main()
{
char *a = "hello";
char *b = "world";
a = a + (a-b);
b = a - (a-b)/2;
a = a - (a-b)*2;
printf(" a = %s b = %s ",a,b);
return 0;
}

Is This Answer Correct ?    26 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which bitwise operator is used to check whether a particular bit is on or off?

1006


What is singleton class in c++?

984


Explain deep copy?

993


Why is c++ awesome?

978


List the types of polymorphism in c++?

1050


Define basic type of variable used for a different condition in C++?

1046


Which is the best c++ compiler for beginners?

1011


Explain selection sorting. Also write an example.

980


Is there structure in c++?

968


How many standards of c++ are there?

1047


Describe the syntax of single inheritance in C++?

1020


Why pointer is used in c++?

1080


Can you please explain the difference between using macro and inline functions?

989


Why is c++ still used?

1007


Explain about Garbage Collector?

1057