how to swap two strings without using any third variable ?

Answer Posted / santosh panigrahy

int main()
{
char *a = "hello";
char *b = "world";
a = a + (a-b);
b = a - (a-b)/2;
a = a - (a-b)*2;
printf(" a = %s b = %s ",a,b);
return 0;
}

Is This Answer Correct ?    26 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of default constructor?

579


Which is most difficult programming language?

592


What is the use of setprecision in c++?

554


Do you know the use of vtable?

652


What is std :: flush?

590






What are the advantage of using register variables?

647


What is a driver program?

643


Is swift a good first language?

594


Explain rtti.

601


Who invented turbo c++?

619


Is c++ harder than java?

581


What do you mean by static variables?

612


What is the full form of ios?

564


How do you declare a set in c++?

546


Write some differences between an external iterator and an internal iterator? Describe the advantage of an external iterator.

619