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
What is the v-ptr?
What do you mean by function overriding & function overloading in c++?
How delete [] is different from delete?
How a modifier is similar to mutator?
Discussion on error handling of C++ .
what are Access specifiers in C++ class? What are the types?
What is a static member?
What is a local variable?
How many types of classes are there in c++?
How are the features of c++ different from c?
What is runtime polymorphism in c++?
Differences between private, protected and public and give examples.
How many keywords are used in c++?
What is the full form of stl in c++?
Differentiate between a template class and class template in c++?