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 do we need constructors in c++?
What is the role of static keyword for a class member variable?
What is encapsulation in c++ with example?
Are strings mutable in c++?
What is the basic of c++?
What is a modifier in c++?
What information can an exception contain?
Explain the isa and hasa class relationships.
How one would use switch in a program?
If I is an integer variable, which is faster ++i or i++?
Write about the members that a derived class can add?
Is c++ the best programming language?
Write a Program for read a line from file from location N1 to N2 using command line arguments. Eg:exe 10 20 a.c
What are the 4 types of library?
What are the types of container classes?