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

What do you mean by translation unit?

1091


When do you call copy constructors?

1145


What is wrapper class in c++?

1110


Explain dangling pointer.

1121


You want to link a c++ program to c functions. How would you do it?

991


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

1230


How do you add an element to a set in c++?

990


How would you use qsort() function to sort an array of structures?

1119


What is the use of string in c++?

1023


What is ofstream c++?

1084


Is C++ case sensitive a) False b) Depends on implementation c) True

1070


Can static member variables be private?

1170


What is the purpose of template?

1109


Which software is best for programming?

1152


Is there any function that can skip certain number of characters present in the input stream?

1066