The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
160 views

Suppose a, b, c and d are int variables. For ternary operator in C ( ? : ), pick the best statement.

(A) a>b ? : ; is valid statement i.e. 2nd and 3rd operands can be empty and they are implicitly replaced with non-zero value at run-time.
(B) a>b ? c=10 : d=10; is valid statement. Based on the value of a and b, either c or d gets assigned the value of 10.
(C) a>b ? (c=10,d=20) : (c=20,d=10); is valid statement. Based on the value of a and b, either c=10,d=20 gets executed or c=20,d=10 gets executed.
(D) All of the above are valid statements for ternary operator.

asked in Programming by (169 points) | 160 views
0
B and C I think is true.. A I don't know..
0
All the statements are valid
0
Option (C) is correct only

Please log in or register to answer this question.

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
49,548 questions
54,174 answers
187,487 comments
71,129 users