Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C++

Knowledge base — C++

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

Entries: 674

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

std::int64_t — exactly 64-bit signed integer type

std::int64_t from <cstdint> is an alias for a signed integer type with exactly 64 bits and no padding bits. Its availability is optional; do not assume that it always means long long.

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

std::int8_t — an exactly 8-bit signed integer

std::int8_t from <cstdint> is an optional alias for a signed integer type with exactly 8 bits and no padding bits. It stores values from -128 to 127. Calculations follow integral promotion rules, and explicitly converting to int is useful when printing its numeric value.

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

std::monostate — an explicit state without data

std::monostate is an empty type available through <variant>. It can represent an explicit state without data and, as the first std::variant alternative, enables default construction even when a later type has no default constructor.

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

std::nullptr_t — the type of nullptr

std::nullptr_t is the distinct type of the nullptr literal, made available by <cstddef>. It is not a pointer type: its values can produce null pointers, while the type itself lets function overloads recognize nullptr.

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

std::ptrdiff_t — pointer difference type

std::ptrdiff_t is an implementation-defined signed integer type from <cstddef>. It is the result type of pointer subtraction, representing a distance in elements rather than bytes, and can hold negative values.

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

std::size_t — the object-size type

std::size_t is an implementation-defined unsigned integer type that can represent the size of any object in bytes. It is the result type of sizeof and is declared by <cstddef>. Do not assume a particular width or use it to represent negative values.

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

std::uint16_t — an unsigned integer with exactly 16 bits

std::uint16_t from <cstdint> is an optional alias for an unsigned integer type with exactly 16 bits and a range of 0–65535. It is useful when an exact width is required, but it does not guarantee a two-byte size on every platform.

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

std::uint32_t — exact-width 32-bit unsigned type

std::uint32_t from <cstdint> aliases an unsigned integer type with exactly 32 bits and no padding bits. It holds values from 0 through 4294967295. Whether the alias is available depends on the implementation.

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

std::uint64_t — 64-bit unsigned integer

std::uint64_t from <cstdint> is an optional alias for an unsigned integer type with exactly 64 bits and no padding bits. It stores values from 0 through 18446744073709551615.

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

std::uint8_t — 8-bit unsigned integer type

std::uint8_t from <cstdint> is an optional alias for an unsigned integer type with exactly 8 bits and a range of 0–255. It undergoes integral promotions in calculations and may behave as a character when printed.

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

std::uintptr_t — an integer type for holding a pointer value

std::uintptr_t from <cstdint> is an unsigned integer type that supports converting a valid void* to an integer and back without losing the pointer value. It is optional in C++23 and specifies neither a fixed width nor a portable address format.

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

unsigned char — a one-byte unsigned integer type

unsigned char is an unsigned integer type distinct from char and signed char. It occupies one C++ byte, not necessarily eight bits. It is useful for byte values, but undergoes integral promotions in expressions.

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

unsigned int — unsigned integer type

unsigned int stores nonnegative integers and is a distinct type from int. It has at least 16 value bits, and its arithmetic operates modulo 2^N. Learn the equivalent unsigned spelling and the pitfalls of conversions and comparisons involving signed integers.

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

unsigned long — unsigned integer type

unsigned long is a standard unsigned integer type with a width of at least 32 bits. It is the same type as unsigned long int. Its exact range depends on the implementation, and arithmetic performed in this type follows modular rules.

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

unsigned long long — unsigned integer type

unsigned long long is a built-in unsigned integer type with at least 64 value bits. It stores nonnegative integers, and its arithmetic operates modulo 2^N. Its exact width depends on the implementation.

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

unsigned short — unsigned short integer type

unsigned short is a built-in unsigned integer type, equivalent to unsigned short int. It supports at least the values from 0 through 65535, but need not be exactly 16 bits wide. In calculations, it is subject to integral promotions.

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