Beginner
minutes
Data Types Terminology
Overview of data type concepts and terminology in this chapter.
Last updated:
This reference provides an overview of data type terminology you'll encounter in this chapter. Use it as a quick lookup guide.
Fundamental Types
| Term | Definition | Example |
|---|---|---|
| Fundamental type | Built-in types provided by the language | int, double, char, bool |
| Integral type | Types that represent whole numbers | int, short, long, char |
| Floating-point type | Types that represent decimal numbers | float, double, long double |
| Boolean type | Type representing true/false values | bool |
| Character type | Type representing single characters | char, wchar_t, char16_t |
| Void type | Type representing no value or type | void function return type |
Integer Types
| Term | Definition | Example |
|---|---|---|
| Signed integer | Integer that can be positive or negative | int x{-5}; |
| Unsigned integer | Integer that can only be non-negative | unsigned int x{5}; |
| Short | Integer type with at least 16 bits | short s{100}; |
| Int | Integer type with at least 16 bits | int i{1000}; |
| Long | Integer type with at least 32 bits | long l{100000L}; |
| Long long | Integer type with at least 64 bits | long long ll{1000000LL}; |
| Fixed-width integer | Integer with guaranteed bit size | std::int32_t, std::uint64_t |
| size_t | Unsigned type for sizes and indices | std::size_t len{array.size()}; |
Floating-Point Types
| Term | Definition | Example |
|---|---|---|
| Float | Single-precision floating-point (32 bits) | float f{3.14f}; |
| Double | Double-precision floating-point (64 bits) | double d{3.14159}; |
| Long double | Extended-precision floating-point | long double ld{3.14159L}; |
| Precision | Number of significant digits stored | Float: ~7, Double: ~15-16 |
| Rounding error | Small inaccuracy in floating-point math | 0.1 + 0.2 may not equal 0.3 |
| Scientific notation | Representing numbers as mantissa x 10^exponent | 6.022e23 |
| Mantissa | The significant digits in scientific notation | 6.022 in 6.022e23 |
| Exponent | The power of 10 in scientific notation | 23 in 6.022e23 |
Type Properties
| Term | Definition | Example |
|---|---|---|
| sizeof | Operator returning size in bytes | sizeof(int) returns 4 |
| Range | Minimum and maximum values a type can hold | int: -2^31 to 2^31-1 |
| Overflow | Value exceeds the maximum for its type | int x{2147483647 + 1}; |
| Underflow | Value goes below minimum for its type | Subtracting from unsigned 0 |
| Wraparound | Overflow causing value to wrap to other end | Unsigned overflow wraps to 0 |
Type Conversion
| Term | Definition | Example |
|---|---|---|
| Implicit conversion | Automatic type conversion by compiler | double d = 5; (int to double) |
| Explicit conversion | Programmer-requested type conversion | static_cast<int>(3.14) |
| static_cast | Safe explicit type conversion operator | static_cast<double>(x) |
| Narrowing conversion | Conversion that may lose data | int x = 3.7; (loses .7) |
| Widening conversion | Conversion that preserves all data | double d = 5; (int to double) |
| Promotion | Implicit widening during operations | char promoted to int in math |
| Truncation | Cutting off decimal part | int x = 3.9; becomes 3 |
Boolean & Character
| Term | Definition | Example |
|---|---|---|
| Boolean | Type with only two values: true or false | bool isValid{true}; |
| Truthiness | Non-zero values evaluate as true | if (5) is true |
| Character literal | Single character in single quotes | 'A', '1', '\n' |
| ASCII | Character encoding standard | 'A' = 65, 'a' = 97 |
| Escape sequence | Special character using backslash | '\n', '\t', '\\' |
Create an account to track your progress and access interactive exercises. Already have one? Sign in.
Data Types Terminology - Quiz
Test your understanding of the lesson.
7 questions
10 minutes
60% to pass
Lesson Discussion
Share your thoughts and questions
💬
No comments yet. Be the first to share your thoughts!