Data types in C++ (1)
Course: C++ Part 1 - chapter 4
C++ is a strictly typed language. So you need to specify the data type of all variables before assigning them values or using them. Generally, data types can be categorised into 3 types:
- Primary / Built-in data types
- Derived data types
- User defined data type

Sizes of Primary data types
Section titled “Sizes of Primary data types”
💡 Sizes of derived data types and user defined data types can be calculated from the size of primary data types. For example an integer array of length 8, will contain 8 integers. Each integer is 4 bytes. So the array size will be 8 * 4 bytes = 32 bytes
💡 The sizes (especially int and long long int) helps us identify which data type to use for inputs and calculations.