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 do we need constructors in c++?

1075


What is the role of static keyword for a class member variable?

1041


What is encapsulation in c++ with example?

970


Are strings mutable in c++?

1098


What is the basic of c++?

1026


What is a modifier in c++?

1094


What information can an exception contain?

1104


Explain the isa and hasa class relationships.

1002


How one would use switch in a program?

1040


If I is an integer variable, which is faster ++i or i++?

1035


Write about the members that a derived class can add?

944


Is c++ the best programming language?

979


Write a Program for read a line from file from location N1 to N2 using command line arguments. Eg:exe 10 20 a.c

1240


What are the 4 types of library?

1133


What are the types of container classes?

1103