Write a program to exchange two variaables without temp
Answers were Sorted based on User's Feedback
Answer / sujith
another quick way is,
void main()
{
int a = 10, b = 5;
a ^= b ^= a ^= b;
}
| Is This Answer Correct ? | 7 Yes | 0 No |
Answer / kadher
void main()
{
int a=10,b=5;
a=a^b;
b=a^b;
a=a^b;
}
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / srinivas
main()
{
int a=3,b=2;
a = (a+b)-(b=a);
printf("a=%d,b=%d",a,b);
}
o/p:- a=2,b=3
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / vijay
Sir,... im not comfortable with the 2nd ans cud pls explain
me .?????/
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / haihere
Ans 3 is proper answer,coz in 1 it wont check for
range,,ans 3 is the rigt..
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / sandeep rehlan
Sir, please explain me the 3rd and 6th answer because both
are the orrect way of swapping of two variables.
| Is This Answer Correct ? | 0 Yes | 0 No |
The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference
Explain what is a pragma?
what are advantages of U D F?
How to convert a binary number to Hexa decimal number?? (Note:Do not convert it into binary and to Hexadecimal)
Is null always equal to 0(zero)?
Why is c faster?
main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }
What is the mean of function?
Explain modulus operator.
Explain what?s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?
How do you determine if a string is a palindrome?
How to reverse a string using a recursive function, with swapping?