Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Knowledge base

Knowledge base

Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.

Entries: 5788

C++

Unary minus in C++

Unary minus negates one operand. In `return -1;`, it produces an `int` value that this function uses to mean “not found”; it is not subtraction.

Advanced · ISO C++23; implementation support may vary
C++

Unary negation (`-`) in C++

Unary minus computes the negative of one operand, whereas binary subtraction computes a difference. The promoted type determines what happens at the limits of its range.

Advanced · ISO C++23; implementation support may vary
C++

Unsigned integer literal suffix `u`

The suffix `u` or `U` selects an unsigned integer type, not a fixed width. `0u` and `1u` are `unsigned int`; a larger value can require a wider type.

Advanced · ISO C++23; implementation support may vary
C++

The `ULL` integer literal suffix

`ULL` gives an integer literal the type `unsigned long long` when its value fits, which can change overload selection or how a bit shift is evaluated.

Advanced · ISO C++23; implementation support may vary
C++

UTF-8 code units, code points and grapheme clusters in C++

UTF-8 text has different lengths depending on what you count: code units, code points or grapheme clusters. The example counts and truncates well-formed UTF-8 without splitting a code point.

Advanced · ISO C++23; implementation support may vary
C++

Value-initialization and empty braces `{}` in C++23

Empty braces do not always mean value-initialization. The type determines whether they initialize a scalar, call a constructor, or apply the rules for aggregates.

Advanced · ISO C++23; implementation support may vary
C++

C++ structured bindings with `auto [a, b, c]`

A structured binding names the components of one object. Choosing `auto`, `auto&`, or `const auto&` changes how that object is stored or referred to.

Intermediate · ISO C++23; implementation support may vary
C++

Forwarding reference T&&

A forwarding reference T&& lets a template accept lvalues and rvalues while retaining the information needed to forward the argument onward. It requires the appropriate deduction context; && alone is not enough.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

Lvalue reference: T&

A T& reference aliases an object or a function without making a copy. It cannot be reseated after initialization. For object types, const T& restricts modification through the reference and can also bind to a suitable temporary object.

Basic · C++23; repository compiler flag, production runtime not attested
C++

Pointer-to-member declarators

A pointer to member identifies a non-static data member or member function without binding to a particular object. Declare it using C::*, then apply it to an object with .* or through an object pointer with ->*.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

T* pointer declarator

The `T*` declarator forms the type “pointer to T”. In `int* p = &value;`, `p` holds a pointer to `value`, not a copy of that integer. The position of `const` determines whether the restriction applies to the pointed-to object or to the pointer itself.

Basic · C++23; repository compiler flag, production runtime not attested
C++

Rvalue reference: T&&

T&& declares an rvalue reference, a type distinct from T&. It binds to suitable rvalues and participates in move semantics. A reference name used as an expression is normally an lvalue. In C++23, however, a move-eligible name is an xvalue, as when the name of an rvalue-reference parameter referring to a non-volatile object type is used directly as the operand of a return statement. T&& with a deduced template parameter can be a forwarding reference.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

alignas — specifying alignment

alignas specifies an alignment requirement for a variable, data member, or class. It accepts a type or an integral constant expression and cannot weaken the natural alignment of the declared object or type.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

and — alternative spelling of logical AND

`and` is an alternative spelling of `&&` in C++. The built-in operator tests whether both conditions are true and skips the right operand when the left operand is false.

Basic · C++23; repository compiler flag, production runtime not attested
C++

and_eq — alternative spelling of bitwise AND assignment

and_eq is a reserved C++ keyword and an alternative spelling of &=. For built-in integral types, it performs bitwise AND and stores the result in the left operand. It is not the logical operator and.

Basic · C++23; repository compiler flag, production runtime not attested
C++

asm — assembly declaration

The asm keyword introduces a declaration typically used to pass text to an assembler. Support is conditional and its meaning is implementation-defined, so it is not a portable way to execute processor instructions.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

auto — variable type deduction

The auto keyword stands for a type deduced by the compiler from an initializer. It shortens declarations without losing static typing; writing auto& or const auto& specifies whether the declaration creates a reference.

Basic · C++23; repository compiler flag, production runtime not attested
C++

bitand — alternative spelling of &

`bitand` is a reserved alternative spelling of the `&` token in C++. It therefore means more than bitwise AND: depending on context, it can also take an address or declare an lvalue reference.

Basic · C++23; repository compiler flag, production runtime not attested
C++

bitor — alternative spelling of bitwise OR

`bitor` is an alternative spelling of the C++ operator `|`. The built-in operator performs bitwise inclusive OR: a result bit is set when the corresponding bit of at least one operand is set. Do not confuse it with logical `or` (`||`).

Basic · C++23; repository compiler flag, production runtime not attested