while — pre-test loop
A while loop checks its condition before each iteration. It repeats while the condition is nonzero and may never execute its body.
CKTIS / C
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
A while loop checks its condition before each iteration. It repeats while the condition is nonzero and may never execute its body.
Macros from <stdint.h> produce portable integer constant expressions without manually selecting suffixes. Their numbered variants correspond to minimum-width types, not necessarily exact-width types.
Distinguish the language version, execution environment, missing optional features, and header revisions. These macros select code during compilation; they do not attest that the production runtime works.
NULL from <stddef.h> denotes a null pointer constant. Use it to initialize pointers and compare them with a null value.
The offsetof macro from <stddef.h> gives a subobject's offset from the start of an object as a constant expression of type size_t.
The C23 unreachable macro marks a path execution must never reach. Reaching the invocation causes undefined behavior.
The main function is the starting point of a C program in a hosted environment. Its result reports program termination to that environment.
The binary * operator multiplies arithmetic values. The result and overflow rules depend on the operand types after the usual conversions.
Binary + adds numbers or moves a pointer by an integer number of array elements, rather than bytes.
The += operator adds the right operand to the left and stores the result on the left, evaluating the destination only once.
The unary & operator produces a pointer to an object or function. It enables operations such as modifying an object indirectly through a pointer.
The C23 alignof operator reports a type's alignment requirement in bytes, not an object's size.
The [] operator designates an element using an array or pointer and an integer index. Indexing starts at zero; the programmer must keep accesses within bounds.
The = operator stores a value in the object on its left. Do not confuse assignment with equality comparison == or initialization.
The binary & operator keeps only bits set in both integer operands. One common use is masking bits.
The &= operator stores a bitwise AND result in its left operand, retaining only bits set in both operands.
The ~ operator inverts an integer value's bits after integer promotions. Use it to invert masks and clear selected bits.
The | operator combines the bits of two integers. It can set flags without clearing other bits.
The |= operator stores the operands’ bitwise OR in the left operand. Use it to set mask bits.
The ^ operator compares corresponding bits of two integers. A result bit is 1 when the operand bits differ.
The ^= operator computes bitwise XOR, converts the result to the type of the left operand, and stores it there.
A cast explicitly converts an expression's value. Its placement determines whether conversion happens before or after a calculation.
The `,` operator evaluates the left expression before the right, discards the left value, and yields the right result.
The ?: operator selects one of two expressions using a condition and supplies its value after required conversions.