What's the “condition” in C interview test?

后端 未结 30 2866
旧时难觅i
旧时难觅i 2020-12-05 02:37

Would it be possible to print Hello twice using single condition?

if  \"condition\"
  printf (\"Hello\");
else
  printf(\"World\");         


        
30条回答
  •  一向
    一向 (楼主)
    2020-12-05 02:59

    So... you want to execute the code inside the if block... and the code inside of the else block... of the same if/else statement? Then... you should get rid of the else and stick taht code in the if.

    if something
      do_this
      do_that
    end
    

    The else statement is designed to execute only if the if statement is not executed and vice-versa, that is the whole point. This is an odd question...

提交回复
热议问题