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

Explain the differences between list x; & list x();.

1018


What is & in c++ function?

1065


Does a derived class inherit or doesn't inherit?

1093


What is the difference between an external iterator and an internal iterator? Describe an advantage of the external iterator.

1067


Why is c++ called oops?

1180


Name four predefined macros.

1041


Which is not a valid keyword a) public b) protected c) guarded

1264


What is private inheritance?

1097


How many static variables are created if you put one static member into a template class definition?

1048


Does c++ have foreach?

1066


What is copy constructor? Can we make copy constructor private in c++?

1091


Will c++ be replaced?

1046


Should the member functions which are made public in the base class be hidden?

1034


What is low level language in simple words?

1032


describe private access specifiers?

1241