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 can a program be made to print the line number where an error occurs?
what is the output of the following program? #include<stdio.h> void main() { float x=1.1; while(x==1.1) { printf("\n%f",x); x=x-0.1; } }
Can the sizeof operator be used to tell the size of an array passed to a function?
Describe the modifier in c?
What is this pointer in c plus plus?
A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(
Explain output of printf("Hello World"-'A'+'B'); ?
illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question
Can we use any name in place of argv and argc as command line arguments?
study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above
What is the use of a static variable in c?
What is extern keyword in c?