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 / chitranshu asthana

char* s1 = "Hello";
char* s2 = "World";
s1 = (char*)((int)s1 + (int)s2);
s2 = (char*)((int)s1 -(int) s2);
s1 = (char*)((int)s1 - (int)s2);
printf("%s:%s", s1, s2);

Is This Answer Correct ?    91 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why null pointer is used?

1044


Is swift faster than go?

1094


In inline " expression passed as argument are evalauated once " while in macro "in some cases expression passed as argument are evaluated more than once " --> i am not getting it plz help to make me understand....

2417


What are put and get pointers?

1118


List the issue that the auto_ptr object handles?

1024


Define friend function.

1043


Can you use the function fprintf() to display the output on the screen?

1243


Do you know about latest advancements in C++ ?

1229


How can you quickly find the number of elements stored in a static array? Why is it difficult to store linked list in an array?

975


What is conditions when using boolean operators?

1217


When is dynamic checking necessary?

1109


What is an orthogonal base class in c++?

1158


Differentiate between an external iterator and an internal iterator? What is the advantage of an external iterator.

1037


Differentiate between late binding and early binding. What are the advantages of early binding?

1029


When do we use copy constructors?

1079