a=0;
b=(a=0)?2:3;
a) What will be the value of b? why
b) If in 1st stmt a=0 is replaced by -1, b=?
c) If in second stmt a=0 is replaced by -1, b=?
Answer Posted / ashwin kumar
3 is the answer
2nd guy says we can't use "=" it's wroung we can use it in
this condition .
expl:
1st it will check condition part , condition part will
return false as, ANY VALUE OTHER THAN ZERO TAKEN AS TRUE IN
C LANGUAGE , here we are assiging zero to 'a' which give
false.
from basic of above contion , it condition return false it
will execute or return 2nd statement, i.e 3
so out put will be 3
| Is This Answer Correct ? | 7 Yes | 1 No |
Post New Answer View All Answers
Why clrscr is used after variable declaration?
why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above
What are compound statements?
How can you tell whether a program was compiled using c versus c++?
What is anagram in c?
What is main return c?
What is the maximum no. of arguments that can be given in a command line in C.?
simple program of graphics and their output display
List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.
What is the difference between the expression “++a” and “a++”?
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays
Explain what is wrong in this statement?
What is the difference between malloc() and calloc() function in c language?
What does typedef struct mean?
How do I send escape sequences to control a terminal or other device?