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 |
What is the purpose of 'register' keyword in c language?
What is a ternary operator in c?
write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3
explain how do you use macro?
implement NAND gate logic in C code without using any bitwise operatior.
Can we access array using pointer in c language?
How will you allocate memory to double a pointer?
Tell us the difference between these two : #include"stdio.h" #include<stdio.h> define in detial.
What is the difference between c &c++?
What is a stream in c programming?
Why array starts with index 0
If an old women's age is the same as her three grand daughters i,mean the number of days old child=the no of weeks old child=no of months old child .The total yrs of all these ppl is 114 yrs...then how old is the old woman? the yr has 365 days..and 30 days each month.