what is primary expression?? - Programmers Heaven

Howdy, Stranger!

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

Categories

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.