C Extended Types

C Extended Types (Beginner → Advanced)
In C language, extended types refer to type modifiers and extended data type variations that go beyond the basic types (int, char, float, double).
They are used to control size, range, precision, and behavior of data, and are important for system programming & interviews.
What Are Extended Types?
Extended types are modified or extended forms of basic data types created using type modifiers and qualifiers.
They help you:
Save memory
Increase range
Improve performance
Write hardware-level code
Type Modifiers (Core Extended Types)
C provides four type modifiers:
| Modifier | Meaning |
|---|---|
short | Smaller size |
long | Larger size |
signed | Can store + and − values |
unsigned | Stores only + values |
Extended Integer Types
Common Integer Variants
| Type | Typical Size* | Range (approx) |
|---|---|---|
short int | 2 bytes | −32,768 to 32,767 |
unsigned short int | 2 bytes | 0 to 65,535 |
int | 4 bytes | −2B to +2B |
unsigned int | 4 bytes | 0 to 4B |
long int | 4 / 8 bytes | Very large |
unsigned long int | 4 / 8 bytes | Larger positive |
*Size depends on compiler & system
Example
Signed vs Unsigned Types
- Unsigned types cannot store negative values
Extended Character Types
| Type | Range |
|---|---|
signed char | −128 to 127 |
unsigned char | 0 to 255 |
- Used in embedded systems & byte-level operations
Extended Floating-Point Types
| Type | Size | Precision |
|---|---|---|
float | 4 bytes | ~6 digits |
double | 8 bytes | ~15 digits |
long double | 10–16 bytes | Highest |
Example
- Used in scientific & financial applications
Type Qualifiers (Often Included in Extended Types)
| Qualifier | Purpose |
|---|---|
const | Value cannot change |
volatile | Value can change unexpectedly |
restrict | Pointer optimization |
_Atomic | Thread-safe access |
Example
Extended Types Using typedef
- Improves readability
- Used heavily in system libraries
Fixed-Width Integer Types (<stdint.h>) (Modern C)
Provides portable extended types.
| Type | Meaning |
|---|---|
int8_t | 8-bit signed |
uint8_t | 8-bit unsigned |
int16_t | 16-bit |
uint32_t | 32-bit |
int64_t | 64-bit |
- Preferred in embedded & cross-platform code
Extended Types in Real Life
Embedded systems →
uint8_t,volatileOS kernels →
unsigned long,typedefNetworking → fixed-width integers
Finance →
long doubleMemory optimization →
short,unsigned
Common Mistakes
- Assuming same size on all systems
- Using
unsignedfor negative logic - Ignoring overflow behavior
- Not using
<stdint.h>when portability matters
Interview Questions (Must Prepare)
What are extended data types in C?
Difference between
signedandunsignedWhy use
long double?What is
uint32_t?When to use
volatile?Size difference between
intandlong
Summary
- Extended types modify basic data types
- Control size, range, and behavior
signed,unsigned,short,longare key<stdint.h>provides portable extended types- Critical for system programming & interviews
