Semantics of `printf(“…”) || printf(“…”) || printf(“…”)`

后端 未结 3 1541
太阳男子
太阳男子 2021-01-29 11:39

I\'m wondering what the following statement will print in C?

printf(\"hello\\n\") || (printf(\"goodbye\\n\") || printf(\"world\\n\"));

I\'m usu

3条回答
  •  Happy的楠姐
    2021-01-29 12:40

    It prints "hello" only!

    http://www.compileonline.com/compile_c_online.php

    #include 
    #include 
    
    main()
    {
      printf("hello\n") || (printf("goodbye\n") || printf("world\n"));
    }
    

提交回复
热议问题