how to swap two strings without using any third variable ?
Answer Posted / santosh panigrahy
int main()
{
char *a = "hello";
char *b = "world";
a = a + (a-b);
b = a - (a-b)/2;
a = a - (a-b)*2;
printf(" a = %s b = %s ",a,b);
return 0;
}
| Is This Answer Correct ? | 26 Yes | 5 No |
Post New Answer View All Answers
What do you mean by translation unit?
When do you call copy constructors?
What is wrapper class in c++?
Explain dangling pointer.
You want to link a c++ program to c functions. How would you do it?
What are the four partitions in which c++ compiler divides the ram?
How do you add an element to a set in c++?
How would you use qsort() function to sort an array of structures?
What is the use of string in c++?
What is ofstream c++?
Is C++ case sensitive a) False b) Depends on implementation c) True
Can static member variables be private?
What is the purpose of template?
Which software is best for programming?
Is there any function that can skip certain number of characters present in the input stream?