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?
Can we get the value of ios format flags?
Show the declaration for a static member variable.
If horse and bird inherit virtual public from animal, do their constructors initialize the animal constructor? If pegasus inherits from both horse and bird, how does it initialize animal’s constructor?
Can comments be longer than one line?
What is function prototyping?
What apps are written in c++?
What is bubble sort c++?
Explain register storage specifier.
Which bit wise operator is suitable for putting on a particular bit in a number?
Will a C compiler always compile C++ code a) Yes b) No c) Only optimized compilers
How do c++ struct differs from the c++ class?
Differentiate between the message and method in c++?
Explain selection sorting. Also write an example.
Write about the retrieval of n number of objects during the process of delete[]p?