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 is an array? What the different types of arrays in c?
How can I get back to the interactive keyboard if stdin is redirected?
Write a program to find factorial of a number using recursive function.
What is restrict keyword in c?
What is main function in c?
Explain how can a program be made to print the name of a source file where an error occurs?
Explain how does flowchart help in writing a program?
What does main () mean in c?
Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.
Why c is procedure oriented?
GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA
What are the 4 types of functions?
What is the concatenation operator?
Difference between strcpy() and memcpy() function?
What is the time and space complexities of merge sort and when is it preferred over quick sort?