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 are external variables in c?
Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.
What are the different types of objects used in c?
What is a stream in c programming?
Why is a semicolon (;) put at the end of every program statement?
What is difference between main and void main?
What are pointers in C? Give an example where to illustrate their significance.
What will be your course of action for a push operation?
How is pointer initialized in c?
What is a structure and why it is used?
What is a double c?
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
Is there any demerits of using pointer?
What is the scope of global variable in c?
Explain what is the difference between the expression '++a' and 'a++'?