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...

this is to swap to strings....but in output the whole
strings are swapped leaving first as it is...why it is so

#include<iostream.h>
int main()
{
char a[]="ajeet";
char b[]="singh";
long x=*a;
long y=*b;
cout<<x<<":"<<y;
x=x+y;
y=x-y;
x=x-y;
*a=x;
*b=y;
cout<<x<<":"<<y;
cout<<&a<<endl;
cout<<&b<<endl;
}

Answer Posted / sachin chakote

only first letter will be swapped

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are shallow and deep copy?

1132


Can a Structure contain a Pointer to itself?

1153


What methods can be overridden in java?

1284


Why isn't sizeof for a struct equal to the sum of sizeof of each member?

1007


What is the difference between #import and #include?

1064


How does class accomplish data hiding in c++?

1193


What is the importance of mutable keyword?

1029


What is c++ namespace?

1225


What is std :: flush?

1086


What are the uses of pointers?

1088


What is object in c++ wikipedia?

1015


Explain how a pointer to function can be declared in C++?

1078


If dog is a friend of boy and boy is a friend of house, is dog a friend of house?

1015


When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?

1115


What is c++ mutable?

1123