The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
119 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 (213 points) | 119 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

0 votes
1 answer
4


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

44,252 questions
49,749 answers
164,069 comments
65,845 users