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


Please Help Members By Posting Answers For Below Questions

What is an array? What the different types of arrays in c?

661


How can I get back to the interactive keyboard if stdin is redirected?

671


Write a program to find factorial of a number using recursive function.

647


What is restrict keyword in c?

645


What is main function in c?

551






Explain how can a program be made to print the name of a source file where an error occurs?

691


Explain how does flowchart help in writing a program?

634


What does main () mean in c?

616


Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.

3127


Why c is procedure oriented?

574


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

1431


What are the 4 types of functions?

574


What is the concatenation operator?

614


Difference between strcpy() and memcpy() function?

681


What is the time and space complexities of merge sort and when is it preferred over quick sort?

676