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
Can you explicitly call a destructor on a local variable?
what is pre-processor in C++?
What are c++ templates used for?
Why can’t you call invariants() as the first line of your constructor?
Why is c++ still best?
Can a program run without main function?
What are protected members in c++?
Write a function to perform the substraction of two numbers. Eg: char N1="123", N2="478", N3=-355(N1-N2).
What are the advantages of using pointers in a program?
What are the advantages of early binding?
What is c++ namespace?
What is the function to call to turn an ascii string into a long?
What does override mean in c++?
There are 100 students in a class. The management keep information in two tables. Those two tables are given like Roll no Name Age 001 ABC 15 002 XYZ 14 and Roll No Subject Marks 001 Math 75 001 Physics 55 002 Math 68 001 Hindi 69 They want the information like this Roll No Name Hindi Physics Math Total 001 ABC 69 55 75 199 002 XYZ 68 74 84 226 And Roll No Suject Highest 001 Math 98 007 Physics 84 021 Hindi 74 All 275 All information is kept in structure in main memory. You have to find last two tables.
Do you need a main function in c++?