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
Can member data be public?
Which bitwise operator is used to check whether a particular bit is on or off?
Write a program to encrypt the data in a way that inputs a four digit number and replace each digit by (the sum of that digit plus 7) modulus 10. Then sweep the first digit with the third, second digit with the fourth and print the encrypted number.
Does c++ vector allocate memory?
Explain deep copy and a shallow copy?
What is the array and initializing arrays in c++?
How would you use qsort() function to sort an array of structures?
How the endl and setw manipulator works?
Why c++ is faster than java?
Is c++ a difficult language?
List the features of oops in c++?
Write some differences between an external iterator and an internal iterator?
Can I run c program in turbo c++?
What's the order in which the objects in an array are destructed?
Is c++ an oop?