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

How do I write a c++ program?

1120


Differentiate between an array and a list?

1185


write a program that withdrawals,deposits,balance check,shows mini statement. (using functions,pointers and arrays)

2392


What is the benefit of encapsulation?

1078


Can we inherit constructor in c++?

1100


Why do we use setw in c++?

1119


Declare a class vehicle and make it an abstract data type.

972


Which is best c++ or java?

1091


What is c++ hiding?

1223


Why are pointers not used in c++?

1142


Explain mutable storage class specifier.

1095


Is c++ faster than c?

1032


What are the differences between java and c++?

1087


Is c++ the best programming language?

1027


what are the iterator and generic algorithms.

1974