1. 程式人生 > >c語言中bool如何輸出

c語言中bool如何輸出

       寫java程式碼時間久了再寫c的程式碼,發現思維很容易混亂,寫c++的時候也容易混亂,今天用c語言想輸出bool型的值,居然用java的方法直接輸出,結果當然不行,仔細想了一想,c中的bool型就是0和1,因此可以用%d輸出,因此。。。程式碼如下:

#include <stdio.h>

void  main()
{
  bool  b = true;
   printf("%d\n",b);

   bool  c = false;
   printf("%d\n",c);
}