美文网首页C
C语言自定义布尔bool类型

C语言自定义布尔bool类型

作者: taobao | 来源:发表于2019-10-16 17:04 被阅读0次

C语言没有布尔类型,可以采用宏定义创建该类型

#include<stdio.h>

typedef int bool;
#define true 1
#define false 0

int main(int argc, char * argv[])
{
   bool a = true;
   bool b = false;
   printf("%d %d\n", a, b);
}

相关文章

网友评论

    本文标题:C语言自定义布尔bool类型

    本文链接:https://www.haomeiwen.com/subject/zkuumctx.html