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 / vignesh1988i
the value is 0 so this will go to 3.. the value of b=3
a) b=3... since we are not comparing the value os a's...
this is an assignment statement.... so a itself is 0, which
is an false condition.... so it moves to 3
b) the value of b=2... since -1 ia an non zero value... the
whole term wil become true....
c) b=2... same reson as above
actually the above conditional operater statement must be
full y enclosed witin braces.... then only we should assign
to a variable....
Is This Answer Correct ? | 4 Yes | 2 No |
Post New Answer View All Answers
What are conditional operators in C?
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above
Write a program to implement queue.
how can f be used for both float and double arguments in printf? Are not they different types?
What is difference between structure and union in c programming?
How do I use void main?
What does it mean when the linker says that _end is undefined?
List the difference between a "copy constructor" and a "assignment operator"?
What does 2n 4c mean?
write a program to rearrange the array such way that all even elements should come first and next come odd
write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)
Explain what is the difference between null and nul?
What is scope and lifetime of a variable in c?
how we can make 3d venturing graphics on outer interface
What is graph in c?