how to swap 2 numbers in a single statement?

Answers were Sorted based on User's Feedback



how to swap 2 numbers in a single statement?..

Answer / ushagva1

a=a+b-(b=a);

Is This Answer Correct ?    21 Yes 2 No

how to swap 2 numbers in a single statement?..

Answer / uj

(x ^= y), (y ^= x), (x ^= y);

Is This Answer Correct ?    0 Yes 0 No

how to swap 2 numbers in a single statement?..

Answer / pedda

t=a;
a=b;
b=t;
t means temporary value

Is This Answer Correct ?    3 Yes 7 No

Post New Answer

More C Interview Questions

What is wrong in this statement? scanf(“%d”,whatnumber);

0 Answers  


Explain what is the general form of a c program?

0 Answers  


How to reverse alternate words in a given line of string For Eg: my name is narasimha output : my eman is ahmisaran

0 Answers  


What is the importance of c in your views?

0 Answers  


What is queue in c?

0 Answers  






write a c program that if the given number is prime, and their rearrangement(permute) of that number is also prime. Ex: Input is "197" is prime Output: 791,917,179 is also prime. Please any one tell me tha code for that

3 Answers  


Which is more efficient, a switch statement or an if else chain?

0 Answers  


int i=~0; uint j=(uint)i; j++; printf(“%d”,j);

1 Answers  


ASCII stands for

1 Answers  


main() { int i=5; printf("%d%d%d%d",i++,i--,i); }

10 Answers  


How can you access memory located at a certain address?

0 Answers  


what is available in C language but not in C++?

10 Answers   CTS, TCS,


Categories