C Operators

CategoryOperators
Arithmetic+ - * / %
Relational== != > < >= <=
Logical&& || !
Bitwise& | ^ ~ << >>
Assignment= += -= *= /= %=
Increment/Decrement++ --
Conditional?:
Specialsizeof, & (address), * (dereference), comma
C
#include <stdio.h>
int main() {
    int a = 12, b = 5;
    printf("%d %d %d\n", a / b, a % b, (float)a / b > 2);
    printf("%d %d %d\n", a & b, a | b, a ^ b);     // 1100 & 0101 ...
    printf("%d %d\n", a << 1, a >> 2);
    int x = 5, y = x++ + ++x;   // avoid code like this!
    printf("max = %d\n", a > b ? a : b);
    return 0;
}
2 2 1 4 13 9 24 3 max = 12
Undefined behaviourExpressions like x++ + ++x modify a variable twice without a sequence point. The result is undefined, so don't rely on it in exams or code.
Track your progress through the C course