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 / vaibhav

b=3
becoz in ternay operator if statement is true then it
returns non zero vaqlue othervise it return 0 in that case
we initialize the value of a is 0 therefore it will exicute
a else part

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which header file is essential for using strcmp function?

908


What is the 'named constructor idiom'?

617


Can main () be called recursively?

607


What is an lvalue?

603


Explain the use of 'auto' keyword in c programming?

646






What is array in C

683


What tq means in chat?

554


Write a program to print ASCII code for a given digit.

657


the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above

693


What is %d used for?

568


Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?

573


Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?

549


What is the difference between array_name and &array_name?

754


what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?

1428


Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?

661