how to swap two strings without using any third variable ?
Answer Posted / rohit kapade
bool SwapString(char **s1,char **s2)
{
//char *temp = NULL;
//temp = *s1;
//*s1 = *s2;
//*s2 = temp;
*s1 = (char*)((int)*s1 + (int)*s2);
*s2 = (char*)((int)*s1 - (int)*s2);
*s1 = (char*)((int)*s1 - (int)*s2);
return true;
}
| Is This Answer Correct ? | 3 Yes | 3 No |
Post New Answer View All Answers
Should the member functions which are made public in the base class be hidden?
What is a forward referencing and when should it be used?
On throwing an exception by the animal constructor in p = new animalq, can memory leak occur?
Evaulate: 22%5 a) 2 b) 4 c) 0
Should I learn c++ c?
What is a rooted hierarchy?
Can I make ios apps with c++?
What is ifstream c++?
What is the best way to take screenshots of a window with c++ in windows?
Is nan a c++?
What are the various storage classes in C++?
How many characters are recognized by ANSI C++?
In c++, what is the difference between method overloading and method overriding?
What is buffering in c++?
Why would you use pointers in c++?