标题:关于bool的定义问题
取消只看楼主
dapeng83
Rank: 1
来 自:河南
等 级:新手上路
帖 子:26
专家分:5
注 册:2009-11-12
结帖率:63.64%
已结贴  问题点数:20 回复次数:0 
关于bool的定义问题
以下是我的程序:
#include <stdio.h>
 #include <stdbool.h>

 int main(void)
 {

    bool  i = true;

    do
    {
       char  m;
       printf("please input a char Y or N"\n);

       scanf("%c",&m);
       switch(m)
       {
       case Y: i = true;
       break;
       case N: i = false;
       break;
       }
     }while(i);

     return 0;
  }
/*
stdbool.h

-- Boolean type and values
(substitute for missing C99 standard header)

public-domain implementation from [EMAIL PROTECTED]

implements subclause 7.16 of ISO/IEC 9899:1999 (E)
*/

#ifndef __bool_true_false_are_defined
#define __bool_true_false_are_defined 1

/* program is allowed to contain its own definitions, so ... */
#undef bool
#undef true
#undef false

#if __STDC_VERSION__ < 199901
typedef int _Bool
#endif

#define bool _Bool
#define true 1
#define false 0

#endif /* !defined(__bool_true_false_are_defined) */
黑色的是我程序,带颜色的是我的stdbool.h头函数里的但我编译的时候却说语法错误,我却不知道错在哪里了,是stdbool.h里面有问题吗,请帮忙解释下,谢谢


搜索更多相关主题的帖子: bool 定义 
2009-12-02 19:50



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-293717-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017367 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved