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


Please Help Members By Posting Answers For Below Questions

Describe the modifier in c?

597


What is your stream meaning?

603


When should a far pointer be used?

600


Explain null pointer.

615


What is a scope resolution operator in c?

745






can any one tel me wt is the question pattern for NIC exam

1553


What is the use of volatile?

604


What are local static variables? How can you use them?

641


Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.

4835


What is self-referential structure in c programming?

655


What is the size of structure pointer in c?

610


Explain what are multidimensional arrays?

596


What is c language & why it is used?

574


Why c is known as a mother language?

636


What are the disadvantages of a shell structure?

686