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
Describe the modifier in c?
What is your stream meaning?
When should a far pointer be used?
Explain null pointer.
What is a scope resolution operator in c?
can any one tel me wt is the question pattern for NIC exam
What is the use of volatile?
What are local static variables? How can you use them?
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.
What is self-referential structure in c programming?
What is the size of structure pointer in c?
Explain what are multidimensional arrays?
What is c language & why it is used?
Why c is known as a mother language?
What are the disadvantages of a shell structure?