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
Why c++ is not a pure oop language?
What is the use of setprecision in c++?
How java is different from c and c++?
Which one is better- macro or function?
What is operators in c++?
What do you mean by inheritance in c++? Explain its types.
How do you define a class in c++?
What are friend functions in C++?
What is scope operator in c++?
What is a driver program?
What is object oriented programming (oop)?
What does scope resolution operator do?
Explain function overloading and operator overloading.
Can you pass a vector to a function?
program explaining feautures of c++