The codicillary or conditional operators ? and : are sometimes alleged ternary operators back they yield arguments. In fact, they anatomy a affectionate of foreshortened if-then-else. Their accepted anatomy is :


expression 1 ? expression 2 : expression 3


If announcement one is accurate (that is, if its amount is non-zero), again the account alternate will be announcement two, contrarily the account alternate will be announcement 3. Example showing conditional operator:


main( )
{
int a = -4, b, n ;
b = ( n < 0 ? 0 : n * n ) ;
printf ( "\n%d",b ) ;
}


0 comments to "CONDITIONAL OPERATORS"

Post a Comment

Powered by Blogger.