0Pricing
C++ Academy · Lesson

Integer vs Floating Point Types

Pick the right numeric type by understanding sizes, ranges, and precision trade-offs.

Two Number Worlds

C++ has two families of numeric types: integers (no fractions, exact) and floating point (approximate, with fractions). Pick the right family for the job.

Integer Types

Built-in integer types and typical sizes on 64-bit systems:

  • char — 1 byte
  • short — 2 bytes
  • int — 4 bytes
  • long — 4 or 8 bytes
  • long long — 8 bytes

All lessons in this course

  1. Integer vs Floating Point Types
  2. The cmath Header: pow sqrt abs round
  3. Random Numbers with the random Header
  4. Numeric Limits and Overflow Behaviour
← Back to C++ Academy