printf conversion specifier for _Bool?

前端 未结 5 879
猫巷女王i
猫巷女王i 2021-02-19 09:04

With printf(), I can use %hhu for unsigned char, %hi for a short int, %zu for a size_t

5条回答
  •  猫巷女王i
    2021-02-19 09:15

    I use %b for a Java printf() conversion specifier. I tried it recently and to my surprise it worked.

    Here is the line of code:

    System.out.printf("firstRobot == secondRobot: %b",firstRobot == secondRobot);
    

    Here is the output:

    firstRobot == secondRobot: false
    

提交回复
热议问题