Calvin's Tech Space

成于坚忍,毁于浮躁

   :: 首页 :: 联系 :: 聚合  :: 管理

使用bool类型定义变量时,编译出错。错误信息显示如下:

     'bool' undeclared (first use in this function)
     (Each undeclared identifier is reported only once
     for each function it appears in.)

  C语言(或C++)里本身没有bool这种布尔类型。有些编译器可以识别,那也是因为编译器自己定义了bool类型,比如:#define bool int。

  C语言里,一般用整型变量来实现布尔型变量的功能。当用条件语句,如if,进行判断时,值为0时返回false,其它都返回true。

posted on 2010-05-12 18:28 calvin 阅读(1506) 评论(0)  编辑  收藏 所属分类: Linux

只有注册用户登录后才能发表评论。


网站导航: