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;
}



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

Answer / sachin chakote

only first letter will be swapped

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

What is #include cstdlib in c++?

0 Answers  


What is c++ & why it is used?

0 Answers  


What is buffer and example?

0 Answers  


What is iterator c++?

0 Answers  


why we cant create array of refrences

4 Answers  


What are the characteristics of friend functions?

0 Answers  


What are the benefits of pointers?

0 Answers  


How to avoid a class from instantiation?

8 Answers   Symphony,


What is scope of a variable? (LOLZ)

2 Answers   CA, TCS,


How did c++ get its name?

0 Answers  


Under what conditions is multiple inheritance not recommended?

1 Answers  


what are the events occur in intr activated on interrupt vector table

0 Answers   HGS,


Categories