c++ - !在 C++ 中的含义(以下上下文)

标签 c++ operator-keyword

我知道当 if(x!=value){...} 时 != 是什么,但它在以下上下文中是什么意思:

 if (! ReadConsoleInput(
                hStdin,      // input buffer handle
                irInBuf,     // buffer to read into
                128,         // size of read buffer
                &cNumRead) ) // number of records read
            ErrorExit("ReadConsoleInput");

if (! SetConsoleMode(hStdin, fdwMode) )
        ErrorExit("SetConsoleMode");

 if (! GetConsoleMode(hStdin, &fdwSaveOldMode) )
        ErrorExit("GetConsoleMode");

最佳答案

它是“非”运算符:如果操作数为零,则为真 (1),否则为假 (0)。

关于c++ - !在 C++ 中的含义(以下上下文),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6287019/

相关文章:

c++ - 在八叉树/四叉树中定位体素的性能

c++ - C++ 中的指针否定 (!ptr == NULL)

c++ - 选择合适的数据结构

c++ - 火力地堡 - future ::错误消息()

java - java中的自增和自减运算符

c++ - 分配不同类别的对象时,分配未给出预期结果

使用文件指针的 C++ 位移位

c++ - 在先前定义的模板类中专门化 friend 运算符错误

c++ - 向上转换函数指针安全吗?

c++ - 使用重载的 operator= 不编译