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 does catch(…) mean?
What is fflush c++?
What do you mean by translation unit in c++?
What is the difference between struct and class?
Describe new operator and delete operator?
why is c++ called oops? Explain
What is endl?
Explain "const" reference arguments in function?
Does improper inheritance have a potential to wreck a project?
Explain the operation of overloading of an assignment operator.
How do I get good at c++ programming?
Can a program run without main function?
Explain the difference between using macro and inline functions?
why and when we can declar member fuction as a private in the class?
What is implicit pointer in c++?