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

后端 未结 30 2847
旧时难觅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:53

    if (printf("hello") & 0)
    {
    printf("hello");
    }
    else
    {
    printf("world");
    

    No need to bother about the return value of printf.

提交回复
热议问题