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 to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???
How can I automatically locate a programs configuration files in the same directory as the executable?
How will you declare an array of three function pointers where each function receives two ints and returns a float?
What is data types?
What is the explanation for modular programming?
What are the advantages of using macro in c language?
How can I get back to the interactive keyboard if stdin is redirected?
Differentiate Source Codes from Object Codes
what is the difference between 123 and 0123 in c?
What is the difference between printf and scanf )?
Is c language still used?
What is meant by recursion?
What is the use of bitwise operator?
What is a file descriptor in c?
What is bash c?