Simultaneous execution of both if and else blocks

后端 未结 13 2308
难免孤独
难免孤独 2020-12-10 17:45

In C or C++

if ( x )
    statement1;
else
    statement2;

For what value of x will both statements be executed?

I know

13条回答
  •  一生所求
    2020-12-10 17:56

    for what value of x both statements will be executed?

    There is no such value: either the value evaluates to true (something != 0), or it evaluates to false) (0). No other possible values exist.

    I know we can execute if-else together like this: if(1){ goto ELSE; } else{ ELSE: }

    That works but it isn’t depending of the value of the if condition at all.

提交回复
热议问题