TheDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
! (logical NOT) operator is a unary operator that performs logical negation. It yields an int value of 1 if its operand compares equal to zero, and 0 if its operand compares unequal to zero.
Syntax
- Arithmetic types (integer and floating-point types)
- Pointer types
! operator is strictly of type int.
The evaluation follows these rules:
- If
operand == 0(orNULLfor pointers),!operandevaluates to1. - If
operand != 0(or non-NULLfor pointers),!operandevaluates to0.
!E is exactly equivalent to (0 == E).
Precedence and Associativity
The ! operator belongs to the unary operators group (Precedence Level 2 in C).
- Associativity: Right-to-left.
- Precedence: It binds more tightly than binary arithmetic, relational, equality, and binary logical operators.
!a == b is parsed as (!a) == b. To negate the result of an equality check, explicit grouping parentheses are required: !(a == b).
Double Negation (!!)
Because ! forces any non-zero value to 0 and any zero value to 1, applying the operator twice sequentially evaluates to a normalized integer boolean representation of the original scalar:
- If
operandis0,!!operandevaluates to0. - If
operandis any non-zero value (e.g.,42,-3.14, or a valid memory address),!!operandevaluates to1.
Master C with Deep Grasping Methodology!Learn More





