C Language Operators: Unary, Logical, Conditional, and Special Expressions
Unary Operators
The bitwise NOT operator (~) performs a one's complement operation, flipping all bits in the binary representation. Since C stores signed integers using two's complement, applying ~ to zero yields -1:
#include <stdio.h>
int main() {
int val = 0;
int result = ~val;
printf("%d\n", result); // Outputs: ...
Posted on Fri, 02 Oct 2026 16:43:25 +0000 by Visualant