Skip to main content
To Get All Information of Sarkari Jobs | Results | Admit Card | And courses ,Internships then CLICK HERE

Conditional Operator/ Special Operator-:



Conditional Operator/ Special Operator is ternary in nature i.e. it require three operands to   perform an operation.It is denoted by " ? : "
 The execution  of conditional operator is as follow-:
      (a-) The first operand is converted to "bool" and then it is evaluated.
      (b-) If the first operands evaluate to TRUE[1], the first expression will execute.
      (c-) If the first operands evaluate to FALSE[0], then second expression will execute.
Syntax-:
   condition?expression 1 : expression 2;
Example-:
                     int x,y;
                     printf("enter value of y");
                     scanf("%d",y);
                     x=(y>5?3:4);
If the value input by user is greater than 5,then output will be 3 and if the value inputted is less than 5, then output will be 4.
ads

Watch The Video Below


Comments

Post a Comment

Please do not enter any spam link in the comment box.


Download The Book "Let Us C" By Yashavant P.Kanetkar,Click The Below Button

-->Email Subscription

Enter Your Email Address:-

Delivered by FeedBurner

Copyright © 2020 TechProgramiz|All Right Reserved|Made By-: Sudarshan Pandey