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

What do you understand by a pure virtual member function?

549


What return value must conversion operators have in their declaration?

618


What do you mean by delegate? Can a user retain delegates?

529


what kind of projects are suitable for c and c++

631


Where are setjmp and longjmp used in c++?

626






What are the advantages of using typedef in a program?

642


What does floor mean in c++?

581


In a function declaration, what does extern mean?

639


How the endl and setw manipulator works?

560


What are maps in c++?

508


What is a flag in c++?

609


What is the purpose of template?

613


What is an adaptor class or wrapper class in c++?

609


What's c++ used for?

599


What is extern c++?

523