Home >Backend Development >C++ >What does ! in c++ mean?
The ! operator in C is a logical NOT operator, used to negate a Boolean expression, turning its true value into a false value or a false value into a true value.
What is the ! Operator?
! is the logical NOT operator in C, also known as the "logical negation" operator.
Function:
! The operator inverts a Boolean expression, that is, if the expression is true, it returns false; if the expression is false, then Return true.
Syntax:
! <boolean_expression>
Operation priority:
! The precedence of the operator is higher than arithmetic operators and lower than other logical operators.
Usage example:
<code class="cpp">bool is_true = true; bool is_not_true = !is_true; // is_not_true 为假</code>
Other notes:
The above is the detailed content of What does ! in c++ mean?. For more information, please follow other related articles on the PHP Chinese website!