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

What is c++ prototype?

1213


Should I learn c or c++ or c#?

1009


What are pointer-to-members? Explain.

1152


What is the difference between a template and a macro?

1067


Implement stack operations with pointers with appropriate exception checks.

980


Will rust take over c++?

1060


What are the four partitions in which c++ compiler divides the ram?

1236


What are advantages of using friend classes?

1076


Write a program to find the Factorial of a number

1064


Can we run c program in turbo c++?

1082


What do you know about near, far and huge pointer?

1140


Suppose that data is an array of 1000 integers. Write a single function call that will sort the 100 elements data [222] through data [321].

1457


Write about the retrieval of n number of objects during the process of delete[]p?

1022


Explain the use of vtable.

1088


Difference between pass by value and pass by reference?

1154