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 |
How does sizeof know array size?
how do we remove the printed character in printf statement and write next it it
What are the different types of control structures?
Find the middle node in the linked list?? (Note:Do not use for loop, count and count/2)
how many keywords are available in 'c' language a) 32 b) 34 c) 45 d) 48
What are the advantages of Macro over function?
what is the difference between embedded c and turbo c ?
How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?
WAP that prints the number from 1 to 100. but for multiplies of three print "XXX" instead of the number and for the multiplies of five print "YYY" . for number which are multiplies of both three and five print "ZZZ"
void main() {int i=2; printf("%d%d%d",i,++i,i++); getch(); }
hi, which software companys will take,if d candidate's % is jst 55%?
Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.