c++ - c语言中bool for function

标签 c++ c

我想在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 .此标题还包含标题 truefalse代表10分别。

关于c++ - c语言中bool for function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20632236/

相关文章:

c++ - IDC 是什么意思?

c++ - 在 winapi 中将 null 传递给 CreateCompatibleDC() 时返回什么

c++ - C/C++ 整数到十六进制到字符 数组到字符

c++ - 用于导出和 C 和 C++ API 的单个头文件

c++ - 如何在 `C++17` 中调用重载对齐的 new 和 delete 运算符?

c++ - 用 SWIG 包装 std::complex<float> 的 4 维 std::vector

c - 释放字符串 char *str = "hello"的内存

c - `memcpy` 不复制所有字节

c++ - std::getline with char* 到字符串

c - 枚举范围