如题所述
C语言中没有布尔型这一数据类型,所以用整型代替,非0表示真,0表示假,但可以使用宏来定义TRUE和FALSE,这样更直观。
温馨提示:答案为网友推荐,仅供参考
第1个回答 2011-06-11
与普通int,char等类似直接定义变量用,,如:bool a,但a的值只有true和false两种情况。
第2个回答 2012-08-26
c语言中没有bool类型
但可以自己造
typedef int bool
#define true 1
#define false 0
#define yes 1
#define no 0
把这个做成头文件,要用时在包括进来就行了
但可以自己造
typedef int bool
#define true 1
#define false 0
#define yes 1
#define no 0
把这个做成头文件,要用时在包括进来就行了
第3个回答 推荐于2017-10-05
使用关键字bool来定义
比如
bool bExist = false;
比如
bool bExist = false;
第4个回答 2011-06-12
直接#include<stdbool.h>
里面有数据类型 bool ,0代表false ,1代表true
里面有数据类型 bool ,0代表false ,1代表true