define the conditional operator in c languagethe


Define the Conditional Operator in c language?

The Simple conditional operator can be carried out with the conditional operators (? And :). An expression that makes use of the conditional operator is called as a conditional expression. The conditional operators,? And: are sometimes called as ternary operators since they take three operands. This universal form is

Expression 1 ? expression 2 : expression 3

This forms state if expression 1 is true then the value returned will be expression 2 or else the value returned will be expression 3. This expression is written in place of traditional if statement.

illustration
y=(x<5?3:4);

This statement will store 3 in y if x is greater than 5 or else it will store 4 in y.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: define the conditional operator in c languagethe
Reference No:- TGS0304663

Expected delivery within 24 Hours