代码点读机 / C++ / not

not C++ · 关键字

逻辑非运算符 ! 的替代拼写,把 true 变 false、false 变 true。

怎么用

not x  等价于 !x

小例子

bool b = not true;
std::cout << b;

运行结果

0

提醒:替代写法,知道即可

官方文档:https://en.cppreference.com/w/cpp/language/operator_alternative

在代码里遇到不认识的词?打开代码点读机,点一下就懂 → ← C++全部词条