Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

what is primary expression??

mian_yiungmian_yiung Posts: 2Member
when i tried to write a program,there was an error saying tat i need a primary expression b4 ";".wats mean by tat?
n could anyone explain to me wat is conditional operator? because when im doing an exercise in "if...else" statement,the exercise asking me to convert the "if...else" statement into conditional operator ( ? : ).

Comments

  • stoberstober Posts: 9,765Member ✭✭✭
    : when i tried to write a program,there was an error saying tat i need a primary expression b4 ";".wats mean by tat?
    : n could anyone explain to me wat is conditional operator? because when im doing an exercise in "if...else" statement,the exercise asking me to convert the "if...else" statement into conditional operator ( ? : ).
    :

    here is an example. if the expression is true then execute the statement after the '?' otherwise if it is false execute statement after ':'.
    [code]
    int i;
    if( )
    i = 1;
    else
    i = 2;

    // the above can be like this
    i = ( ) ? 1 : 2;
    [/code]

Sign In or Register to comment.