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
a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none
What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?
What is external variable in c?
What is volatile variable how do you declare it?
What is difference between structure and union with example?
What are pointers? Why are they used?
What are the general description for loop statement and available loop types in c?
What are the features of c languages?
What is extern storage class in c?
What is queue in c?
how to count no of words,characters,lines in a paragraph.
How are Structure passing and returning implemented by the complier?
Why C language is a procedural language?
Are bit fields portable?
explain what is a newline escape sequence?