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

Why c++ is not a pure oop language?

1093


What is the use of setprecision in c++?

1052


How java is different from c and c++?

1258


Which one is better- macro or function?

1279


What is operators in c++?

1055


What do you mean by inheritance in c++? Explain its types.

1205


How do you define a class in c++?

1135


What are friend functions in C++?

1121


What is scope operator in c++?

1133


What is a driver program?

1156


What is object oriented programming (oop)?

1173


What does scope resolution operator do?

1167


Explain function overloading and operator overloading.

1123


Can you pass a vector to a function?

1032


program explaining feautures of c++

2494