how to swap two strings without using any third variable ?
Answer Posted / chitranshu asthana
char* s1 = "Hello";
char* s2 = "World";
s1 = (char*)((int)s1 + (int)s2);
s2 = (char*)((int)s1 -(int) s2);
s1 = (char*)((int)s1 - (int)s2);
printf("%s:%s", s1, s2);
| Is This Answer Correct ? | 91 Yes | 13 No |
Post New Answer View All Answers
Why null pointer is used?
Is swift faster than go?
In inline " expression passed as argument are evalauated once " while in macro "in some cases expression passed as argument are evaluated more than once " --> i am not getting it plz help to make me understand....
What are put and get pointers?
List the issue that the auto_ptr object handles?
Define friend function.
Can you use the function fprintf() to display the output on the screen?
Do you know about latest advancements in C++ ?
How can you quickly find the number of elements stored in a static array? Why is it difficult to store linked list in an array?
What is conditions when using boolean operators?
When is dynamic checking necessary?
What is an orthogonal base class in c++?
Differentiate between an external iterator and an internal iterator? What is the advantage of an external iterator.
Differentiate between late binding and early binding. What are the advantages of early binding?
When do we use copy constructors?