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
What was noalias and what ever happened to it?
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
Is swift based on c?
What is the meaning of c in c language?
How can variables be characterized?
Is r written in c?
What is getch c?
Why do we write return 0 in c?
What is pointer to pointer in c?
What is difference between structure and union in c?
How do you define a string?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
What is the purpose of main( ) in c language?
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 advantage of pointer in c?