Skip to main content

C++ Primitive Types

· One min read
Hinny Tsang
Data Scientist @ Pollock Asset Management

Notes on C++ Primitive Types.

Primitive Types

  • char: 1 byte, typically used for characters.
  • short: 2 bytes, used for small integers.
  • int: 4 bytes, used for integers. (2 bytes on some systems)
  • float: 4 bytes, used for floating-point numbers.
  • double: 8 bytes, used for double-precision floating-point numbers.
  • bool: 1 byte, used for boolean values (true or false).
  • long int: 8-bytes on 64-bit systems, 4-bytes on 32-bit systems.