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++

Operator function declaration

An operator function declaration gives a function a name consisting of operator followed by an overloadable operator designation, such as operator+. It defines how an operator works for user-defined types without changing its precedence or associativity.

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

Parameter pack and pack expansion

A parameter pack accepts zero or more arguments. A pack expansion applies a pattern to successive elements using `...`. Distinguish declaring a pack, expanding it, and counting its elements with `sizeof...`.

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

Structured binding declaration

A structured binding names elements of an array or a suitable class object. The declaration form alone does not determine whether writing through a binding changes an original element: when plain `auto` copies a `std::tuple<int&, int&>`, the bindings still refer to the same integers.

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

Full and partial template specialization

Template specialization supplies a different definition for specific arguments or a family of arguments. Learn the difference between full specialization with template<> and partial specialization, such as for T*, and the restrictions on function templates.

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

Trailing return type

A trailing return type places the function's result type after the parameter list, following ->. It can specify the result explicitly and can refer to parameter names in a type expression such as decltype(a + b).

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

Using declaration

A using declaration makes a selected name available in the current scope. It can shorten references to namespace names and restore base-class overloads hidden by a declaration in a derived class.

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

Value initialization

Value initialization zero-initializes scalars, works element by element for arrays, and combines conditional zero-initialization with default-initialization for classes. It does not mean that every object will contain only zero values.

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

C-style variadic function: the ellipsis parameter

A trailing ... in a parameter list accepts additional arguments without declared parameter types. The function reads them through <cstdarg>, relying on an agreed count and types; mistakes in that contract can cause undefined behavior.

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

bool — Boolean type

bool is a built-in C++ type with two values: false and true. It stores logical states. Converting a number to bool tests whether the number is nonzero, not whether it equals 1.

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

char — fundamental character type

char is an integral character type occupying exactly one C++ byte. It is distinct from signed char and unsigned char, and its signedness is implementation-defined. A single char value does not necessarily represent a complete text character.

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

char16_t — UTF-16 code unit type

char16_t is a built-in integral type intended to hold UTF-16 code units. One value does not necessarily represent an entire Unicode character: some code points require a pair of code units.

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

char32_t — character type for UTF-32

char32_t is a built-in, distinct integer type used for UTF-32 code units. The U prefix creates the corresponding character and string literals. The type provides at least 32 value bits, but does not itself validate Unicode or guarantee a size of four bytes.

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

char8_t — UTF-8 code unit type

char8_t is a distinct integral type intended for UTF-8 code units, not an alias of unsigned char. The u8 literal prefix produces data of this type, but one code unit does not necessarily represent a complete Unicode character.

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

double — floating-point type

double is a standard floating-point type with at least as much precision as float. It stores values with fractional parts, but its precision is finite and it does not guarantee an exact representation of every decimal number.

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

float — standard floating-point type

float is a built-in floating-point type for storing approximate numeric values. Literals with an f or F suffix have type float, whereas unsuffixed floating-point literals have type double. C++ does not guarantee that float uses IEEE 754 or occupies 32 bits.

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

int — signed integer type

int is a built-in signed integer type that stores negative numbers, zero, and positive numbers. Its width is at least 16 bits; do not assume it is always 32 bits. Dividing two int values produces an integer result, and signed arithmetic overflow causes undefined behavior.

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

long — signed integer type

long is a standard signed integer type with a width of at least 32 bits. The spellings long int and signed long denote the same type. Do not assume, however, that long always has 64 bits or occupies a particular number of bytes.

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

long double — standard floating-point type

`long double` is a distinct standard floating-point type with at least the precision of `double`. It guarantees neither extra precision nor a particular size. The `L` suffix creates literals of this type.

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

long long — a large signed integer type

long long is a built-in signed integer type with a width of at least 64 bits. It is useful for large counters and integer calculations, but its range is still finite, and overflowing signed arithmetic causes undefined behavior.

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

short — signed integer type

short is a standard signed integer type equivalent to short int. Its width is at least 16 bits, but it need not occupy two bytes. In arithmetic, its values undergo integral promotion to int.

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

signed char — a small signed integer type

`signed char` is a built-in signed integer type, distinct from `char` and `unsigned char`. It occupies one C++ byte but need not have exactly 8 bits. It can represent small numeric values, including negative ones.

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

std::byte — a byte without numeric semantics

std::byte from <cstddef> represents raw byte data. It is a distinct enumeration type, not an alias for unsigned char. It supports bitwise operations, but not ordinary arithmetic or implicit conversions to integer types.

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

std::int16_t — an exactly 16-bit signed integer type

std::int16_t from <cstdint> is an optional alias for a signed integer type with exactly 16 bits and no padding bits. It stores values from -32768 to 32767; whether it is available depends on the implementation.

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

std::int32_t — an exactly 32-bit signed integer type

std::int32_t from <cstdint> aliases a signed integer type with exactly 32 bits and no padding bits. Its range is -2147483648 through 2147483647. Whether this alias is available depends on the implementation.

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