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
What is c++ prototype?
Should I learn c or c++ or c#?
What are pointer-to-members? Explain.
What is the difference between a template and a macro?
Implement stack operations with pointers with appropriate exception checks.
Will rust take over c++?
What are the four partitions in which c++ compiler divides the ram?
What are advantages of using friend classes?
Write a program to find the Factorial of a number
Can we run c program in turbo c++?
What do you know about near, far and huge pointer?
Suppose that data is an array of 1000 integers. Write a single function call that will sort the 100 elements data [222] through data [321].
Write about the retrieval of n number of objects during the process of delete[]p?
Explain the use of vtable.
Difference between pass by value and pass by reference?