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 keyword auto for?

561


Should I learn c or c++ first?

558


What is one dimensional array in c++?

570


Do you know about C++ 11 standard?

629


Are vectors faster than arrays?

565






What does n mean in c++?

620


Why do we learn c++?

523


Is java as fast as c++?

593


Why is c++ difficult?

596


How do you master coding?

555


Is nan a c++?

606


Explain the scope of resolution operator.

623


What does count ++ do in c++?

683


What is flush c++?

530


How to implement is-a and has-a class relationships?

576