Skip to content

data type

serhij.zolotukhin edited this page Sep 27, 2026 · 1 revision

int

The size of a C++ int data type is platform-dependent but is guaranteed to be at least 16 bits (2 bytes).

On most modern 32-bit and 64-bit systems, an int is 32 bits (4 bytes).

The C++ standard specifies minimum range requirements, not an exact size in bytes. The actual size is determined by the compiler implementation for the target system.

For Platform-Independent Code

If you need an integer of a specific size regardless of the platform, use the fixed-width integer types available in the header, introduced in C++11.

  • int16_t: Guaranteed to be exactly 16 bits.
  • int32_t: Guaranteed to be exactly 32 bits.
  • int64_t: Guaranteed to be exactly 64 bits.

These types ensure consistent behavior and memory usage across different compilers and architectures.

Data Type Modifiers

  • short

  • long

  • signed

  • unsigned

https://www.geeksforgeeks.org/cpp/cpp-programming-intro/

nullptr

https://towardsdev.com/null-vs-nullptr-the-c-11-fix-for-a-subtle-persistent-bug-92136e37a7c1

My side bar

Clone this wiki locally