C++A while loop checks its condition before each execution of its body. It repeats the body while the condition is true; if the condition is false initially, the body never runs. Termination usually requires changing the state used by the condition.
Basic · C++23; repository compiler flag, production runtime not attestedC++In C++, `xor` is an alternative spelling of the `^` operator. The built-in operator compares corresponding operand bits: a result bit is 1 exactly when the input bits differ. No additional header is required.
Basic · C++23; repository compiler flag, production runtime not attestedC++`xor_eq` is an alternative spelling of the C++ `^=` operator. The built-in operator computes bitwise exclusive OR, then converts the result to the left operand’s type before storing it. In the `unsigned int` example, ones in the mask toggle the corresponding bits, and zeros leave them unchanged.
Basic · C++23; repository compiler flag, production runtime not attestedC++The assert macro from <cassert> checks program assumptions at runtime. NDEBUG disables both checking and condition evaluation, so assertions are not a substitute for input validation.
Basic · C++23; repository compiler flag, production runtime not attestedC++The offsetof macro from <cstddef> determines a member's byte offset from the beginning of an object. It supports memory-layout checks, but portable use requires a standard-layout type.
Intermediate · C++23; repository compiler flag, production runtime not attestedC++The main function in the global namespace is the entry point of an ordinary C++ program. It returns a termination status to the environment, not text for display.
Basic · C++23C++The binary + operator adds numbers or moves a pointer by an integer number of elements. Learn its type conversions, pointer-arithmetic limits, and overflow risks.
Basic · C++23; repository compiler flag, production runtime not attestedC++The += operator adds the right operand to the left operand's value and stores the result back. The built-in operator evaluates the left operand only once; it supports arithmetic and pointer movement.
Basic · C++23; repository compiler flag, production runtime not attestedC++The unary & operator obtains the address of an object or function. Learn the resulting pointer type, the operator's restrictions, and the difference between taking an address, declaring a reference, and bitwise AND.
Basic · C++23; repository compiler flag, production runtime not attestedC++The alignof operator queries a type's alignment requirement in bytes at compile time. It returns a std::size_t value, not the object's size. For an array it reports the element alignment; for a reference type it reports the alignment of the referenced type.
Basic · C++23; repository compiler flag, production runtime not attestedC++The [] operator selects an array element or an element relative to a pointer. Array indices start at zero, and the built-in operator does not check bounds. Classes can define their own operator[], whose behavior depends on its implementation.
Basic · C++23; repository compiler flag, production runtime not attestedC++The = operator assigns a value to an existing object. Learn the left-operand requirements, value conversion, chained assignment, and the distinction between assignment, initialization, and comparison with ==.
Basic · C++23; repository compiler flag, production runtime not attestedC++The binary & operator computes bitwise AND: a result bit is 1 only when both corresponding operand bits are 1. Use it to select bits with a mask; it is not a replacement for logical &&.
Basic · C++23; repository compiler flag, production runtime not attestedC++The &= operator performs bitwise AND and stores the result in its left operand. It keeps only bits that were set in both operands. A common use is retaining selected bits with a mask.
Basic · C++23; repository compiler flag, production runtime not attestedC++The unary ~ operator flips the bits of a value after integral promotions. It is not the logical negation operator !. A mask lets you retain only selected bits of the complemented result.
Basic · C++23; repository compiler flag, production runtime not attestedC++The | operator combines corresponding bits of two values: a result bit is 1 when at least one input bit is 1. It is useful for combining flag masks and is distinct from the logical || operator.
Basic · C++23; repository compiler flag, production runtime not attestedC++The |= operator computes the bitwise inclusive OR of the left operand's current value and the right operand, then stores the result in the left operand. One common use is setting the bits selected by a mask.
Basic · C++23; repository compiler flag, production runtime not attestedC++The ^ operator computes XOR for corresponding bits: a result bit is 1 exactly when the operand bits differ. It is useful for toggling selected bits with a mask; it does not mean exponentiation.
Basic · C++23; repository compiler flag, production runtime not attestedC++The ^= operator performs bitwise exclusive OR. In the XOR calculation, ones in the mask flip the corresponding bits and zeros leave them unchanged. Before storing the result, the operator converts it to the left operand’s type.
Basic · C++23; repository compiler flag, production runtime not attestedC++The co_await expression uses the awaiter protocol to optionally suspend a coroutine and then obtain a result. It does not itself start a thread or provide scheduling; resumption must be arranged by the implementation being used.
Advanced · C++23; repository compiler flag, production runtime not attestedC++The built-in comma operator evaluates its left operand before its right operand, discards the left result, and yields the right result while preserving its type and value category. Do not confuse it with commas separating arguments or declarators.
Intermediate · C++23; repository compiler flag, production runtime not attestedC++The ?: operator selects one of two expressions based on a condition. It evaluates only the selected branch, but the result type depends on both branches. In suitable cases, the result can designate an existing object rather than produce a new value.
Basic · C++23; repository compiler flag, production runtime not attestedC++const_cast explicitly changes const and volatile qualifiers in permitted pointer and reference conversions. It does not change the actual object: removing const from an access type does not permit modifying an object that is actually const.
Intermediate · C++23; repository compiler flag, production runtime not attestedC++The -- operator decreases a numeric value by 1 or moves a pointer back by one element. Prefix --x exposes the modified object, whereas postfix x-- produces a copy of the previous value. Both forms modify their operand.
Basic · C++23; repository compiler flag, production runtime not attested