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
How to implement a packet in C
code for replace tabs with equivalent number of blanks
What is infinite loop?
Why cant I open a file by its explicit path?
Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent
How does pointer work in c?
What is the size of a union variable?
What does c in a circle mean?
What is a void * in c?
How do I use strcmp?
In which language linux is written?
What is scope rule of function in c?
What is clrscr in c?
Explain how can I prevent another program from modifying part of a file that I am modifying?
Is anything faster than c?