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

How does com provide language transparency?

0 Answers  


What are mutator methods in c++?

0 Answers  


What data structure is fastest, on average, for retrieving data: a) Binary Tree b) Hash Table c) Stack

0 Answers  


Write a c program for binary addition of two 8 bit numbers.

0 Answers   TCS,


What are keywords in c++?

0 Answers  






What does the linker do?

0 Answers  


Is multimap sorted c++?

0 Answers  


How the memory management in vectors are being done. What happens when the heap memory is full, and how do you handle it ?

0 Answers   Yahoo,


What are the c++ access specifiers?

1 Answers  


What do you mean by enumerated data type?

0 Answers  


What are containers in c++?

0 Answers  


What are enumerations?

0 Answers  


Categories