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

Write down the equivalent pointer expression for referring the same element a[i][j][k][l]?

1324


Explain what you mean by a pointer.

1156


What is #include cstdlib in c++?

1231


What is pure virtual function? Or what is abstract class?

1119


What are friend classes? What are advantages of using friend classes?

1139


Is map sorted c++?

1050


What's the order in which the local objects are destructed?

1307


Explain stack unwinding.

1142


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

1285


How const int *ourpointer differs from int const *ourpointer?

1186


Snake Game: This is normal snake game which you can find in most of the mobiles. You can develop it in Java, C/C++, C# or what ever language you know.

3062


Write a program to add three numbers in C++ utilizing classes.

1183


What causes a runtime error c++?

1195


What do you mean by inheritance in c++?

1140


What is the difference between #import and #include?

1102