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
Explain the differences between list x; & list x();.
What is & in c++ function?
Does a derived class inherit or doesn't inherit?
What is the difference between an external iterator and an internal iterator? Describe an advantage of the external iterator.
Why is c++ called oops?
Name four predefined macros.
Which is not a valid keyword a) public b) protected c) guarded
What is private inheritance?
How many static variables are created if you put one static member into a template class definition?
Does c++ have foreach?
What is copy constructor? Can we make copy constructor private in c++?
Will c++ be replaced?
Should the member functions which are made public in the base class be hidden?
What is low level language in simple words?
describe private access specifiers?