Ternary Operator

40 views

ternary operator is used where if statement is simple.If the expression 1 is true it expression2 execute otherwise expression 3 will execute.
expression1 ? expression2:  expression3

expression1 : Indicates condition for ternary operator.if this is true then expression2 will execute else expression3 will execute.

expression2 : Indicates first statement.

expression2 : second statement.

Example :

z = (a>b) ? a : b;



« data types CSS History »
Posted on Thursday, June 12th, 2008 at 4:39 pm under C For Beginners | RSS 2.0 Feed

Post Comment

You must be logged in to post a comment.



ComputerEducationWorld.com All Rights Reserved © RSS | CBSE | Education Boards Of India | What is My IP?