我想在c语言中使用bool
首先我在 C++ 中看到
int maximum(int state, **bool choose**);
然后
new_state = maximum(now_State, **true**);
我通过这个在 C 语言中使用 bool 值:
#define true 1
#define false 0
typedef int boolean;
boolean choose = false ;
但我不知道如何设置这样的函数(C++)。
int maximum(int state, **bool choose**);
new_state = maximum(now_State, **true**);
我是外国人。如果您不明白,请告诉我。
最佳答案
要使用 bool 类型,C99 提供了 <stdbool.h>
header 。此 header 提供宏 bool
.此标题还包含标题 true
和 false
代表1
和 0
分别。
关于c++ - c语言中bool for function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20632236/