Decrement operator --
The `--` operator performs a decrement. In C23, decrementing a `bool` that holds `false` stores `true`. The prefix form yields the new value; the postfix form yields the previous value.
CKTIS / C
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
The `--` operator performs a decrement. In C23, decrementing a `bool` that holds `false` stores `true`. The prefix form yields the new value; the postfix form yields the previous value.
The / operator divides two operands. Integer division discards the fractional part; conversion before division enables a floating-point result.
The /= operator divides the left operand's existing value by the right operand and stores the result back.
The == operator tests operands for equality. Its result has type int: 1 means equal, and 0 means unequal.
The () operator calls a function, passing argument values to parameters. It also works with a function pointer; it does not establish argument evaluation order.
The >= operator tests whether the left operand is greater than or equal to the right. It returns int: 1 or 0.
The > operator tests strict ordering. It returns int: 1 for true or 0 for false, including equality.
Prefix `++` yields the operand’s updated value; postfix `++` yields its previous value. These values can be equal: in C23, if a `bool` operand is already `true`, both forms yield `true` and leave the operand unchanged.
The != operator tests whether operands are unequal. It returns an int value: 1 for inequality and 0 for equality.
The << operator shifts bits left. Learn integer promotions, shift-count limits, and the differences between signed and unsigned operands.
The <<= operator shifts an integer value left and stores the result in its left operand.
The <= operator tests whether the left operand is less than or equal to the right operand. Its result is an int: either 1 or 0.
The < operator tests strict ordering. Its int result is 1 when the comparison is true and 0 otherwise.
The && operator tests whether both operands are nonzero. It returns int 0 or 1 and skips the right operand when the left is zero.
The ! operator reverses truth: it produces 1 for zero and 0 for a nonzero value. Its result has type int.
The || operator returns int with value 1 when at least one operand is nonzero; otherwise it returns 0. The right operand may be skipped.
The . operator selects a named member of a struct or union object. For a pointer, use -> instead.
The *= operator multiplies the left operand's current value by the right operand and stores the result back. The left operand is evaluated only once.
The -> operator selects a structure or union member through a pointer. The expression p->x corresponds to (*p).x and supports reading or, when the member is modifiable, writing. It does not validate the pointer.
The % operator computes the remainder of integer division. Results can be negative; a zero divisor causes undefined behavior.
The %= operator stores an integer division remainder in its left operand, evaluating that operand only once.
The >> operator shifts bits right. Its result depends on the left operand's type and sign; the shift count must stay within the permitted range.
The >>= operator shifts an integer value right and stores the result in the left operand.
The sizeof operator returns the size of a type or expression in bytes as size_t. Distinguish array size from pointer size, and remember the variable-length-array exception.