Write a program to interchange two variables without using
the third variable?
Answer Posted / satish
#include<stdio.h>
void main()
{
int x,y;
printf("enter x and y: ");
scanf("%d%d",&x,&y);
x^=y^=x^=y;
printf("elements after swapping: %d,%d\n",x,y);
}
| Is This Answer Correct ? | 20 Yes | 26 No |
Post New Answer View All Answers
What is the right type to use for boolean values in c?
Explain how does flowchart help in writing a program?
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].
What is the argument of a function in c?
Which is the memory area not included in C program? give the reason
How can you call a function, given its name as a string?
What is the 'named constructor idiom'?
What is sizeof in c?
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
What is the meaning of ?
can anyone please tell about the nested interrupts?
Explain what is wrong with this statement? Myname = ?robin?;
What do you understand by friend-functions? How are they used?
How reliable are floating-point comparisons?
What are the 3 types of structures?