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
What is a file descriptor in c?
What is else if ladder?
What will the preprocessor do for a program?
What is identifiers in c with examples?
What is c method?
What is self-referential structure in c programming?
.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }
What is #line used for?
Explain how do you override a defined macro?
What is the difference between the local variable and global variable in c?
Is there a way to compare two structure variables?
Explain what is wrong with this program statement?
What is array in c with example?
How can I send mail from within a c program?
Why do we use int main?