Write a program to interchange two variables without using
the third variable?
Answer Posted / tom macdonald
#include<stdio.h>
void main()
{
int x,y;
printf("enter x and y: ");
scanf("%d%d",&x,&y);
x^=y;
y^=x;
x^=y;
printf("elements after swapping: %d,%d\n",x,y);
}
Is This Answer Correct ? | 29 Yes | 32 No |
Post New Answer View All Answers
Can we add pointers together?
Can we declare a function inside a function in c?
What is null in c?
How would you rename a function in C?
How can I convert a number to a string?
What are two dimensional arrays alternatively called as?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???
What is the importance of c in your views?
Suggesting that there can be 62 seconds in a minute?
Are pointers really faster than arrays?
Why we use break in c?
Explain how do you use a pointer to a function?
Is void a keyword in c?
Explain what are run-time errors?