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

Can a list of string be stored within a two dimensional array?

0 Answers  


What is the topic of the C++ FAQ list?

1 Answers  


What is endl?

0 Answers  


What is c++ vb?

0 Answers  


Explain Text Manipulation Routines?

0 Answers  






Difference between Abstraction and encapsulation in C++?

0 Answers   Impetus,


What is do..while loops structure?

0 Answers  


What is the real purpose of class – to export data?

0 Answers  


Do class method definitions?

0 Answers  


How would you represent an error detected during constructor of an object?

1 Answers  


give me some class & objects examples?

1 Answers  


Difference between delete and delete[]?

5 Answers   Infosys, TCS, Virtusa,


Categories