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 can you increase the size of a statically allocated array?
How can you allocate arrays or structures bigger than 64K?
void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }
How do you do dynamic memory allocation in C applications?
How can you determine the size of an allocated portion of memory?
pierrot's divisor program using c or c++ code
design and implement a data structure and performs the following operation with the help of file (included 1000 student marks in 5 sub. and %also) 1.how many students are fail in all 5 subjects (if >35) 2. delete all student data those are fail in all 5 subjects. 3. update the grace marks (5 no. if exam paper is 100 marks) 4. arrange the student data in ascending order basis of marks. 5.insert double of deleted students with marks in the list.
What is an lvalue?
What is typeof in c?
Explain the difference between malloc() and calloc() function?
Explain how do you convert strings to numbers in c?
What is an operator?
What does %p mean?
What are the usage of pointer in c?
Explain what is the benefit of using #define to declare a constant?