Operators in C

From the C cheat sheet · Operators · verified Jul 2026

Operators

The core operator set.

c
// Quick Reference
+  -  *  /  %          // arithmetic
== != <  >  <= >=      // comparison
&& ||  !               // logical
&  |  ^  ~  << >>        // bitwise
cond ? a : b           // ternary
💡 Integer / truncates toward zero; make an operand a double (2.0) for real division.
⚡ && and || short-circuit - the right side is skipped once the result is decided.
📌 In C, any non-zero value is "true" and 0 is "false" in conditions.
🟢 Bitwise operators (& | ^ ~ << >>) manipulate the binary representation directly.
operators
Back to the full C cheat sheet