Ternary Operator

Computer Education, Training & Tutorial Resources - ComputerEducationWorld.com
Home » Free Educations » Free Programming Training » C Programming » C For Beginners »

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;


• • •
 



captcha PHP Script Free PHP captcha script free php
Website Design by WebWalas.com