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
Write down the equivalent pointer expression for referring the same element a[i][j][k][l]?
Explain what you mean by a pointer.
What is #include cstdlib in c++?
What is pure virtual function? Or what is abstract class?
What are friend classes? What are advantages of using friend classes?
Is map sorted c++?
What's the order in which the local objects are destructed?
Explain stack unwinding.
What are the four partitions in which c++ compiler divides the ram?
How const int *ourpointer differs from int const *ourpointer?
Snake Game: This is normal snake game which you can find in most of the mobiles. You can develop it in Java, C/C++, C# or what ever language you know.
Write a program to add three numbers in C++ utilizing classes.
What causes a runtime error c++?
What do you mean by inheritance in c++?
What is the difference between #import and #include?