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
What is c++ prototype?
Explain about vectors in c ++?
Explain queue. How it can be implemented?
What is c++ good for?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create
What is the difference between structures and unions?
What is the advantage of an external iterator.
Can a constructor return a value?
how to access grid view row?
Specify some guidelines that should be followed while overloading operators?
What are c++ variables?
Why namespace is used in c++?
Distinguish between a # include and #define.
Why cstdlib is used in c++?
Which is better c++ or java?