C Data Types Examples

C Data Types – Examples (Beginner → Practical)
In C language, data types specify what kind of data a variable can store, how much memory it uses, and what operations are allowed on it.
Below are clear examples of all major C data types, exactly the way they are asked in exams & interviews.
Basic (Primitive) Data Types
int – Integer Data Type
Stores whole numbers.
Size: usually 4 bytes
float – Floating Point
Stores decimal numbers (single precision).
Size: 4 bytes
double – Double Precision Float
Stores large decimal values with high precision.
Size: 8 bytes
char – Character Data Type
Stores single character.
Size: 1 byte
Stored internally as ASCII value
Derived Data Types
Array Example
- Stores multiple values of same type
Pointer Example
- Stores address of variable
Structure Example
- Stores different data types together
Union Example
- Shares same memory location
Enumeration (enum) Data Type
- Used for named integer constants
void Data Type
Function Returning Nothing
void Pointer
- Represents no type
Type Modifiers (Extended Data Types)
short, long, signed, unsigned
- Modify range & size
Boolean Type (stdbool.h)
true→ 1false→ 0
Size of Data Types (Example)
Interview-Focused Summary Table
| Data Type | Example | Use |
|---|---|---|
int | int a = 10; | Numbers |
float | float x = 1.5; | Decimals |
double | double d = 2.5; | Precision |
char | char c = 'A'; | Characters |
array | int a[5]; | Multiple values |
struct | struct S {} | Mixed data |
pointer | int *p; | Memory address |
enum | enum Day | Constants |
void | void func() | No return |
Common Mistakes
Using wrong format specifier
Confusing
floatanddoubleForgetting
&inscanf()Assuming same size on all systems
Final Summary
- Data types define type, size & range of data
- C has basic, derived, and user-defined types
- Choosing correct data type improves performance & safety
- Very important for exams, interviews & real projects
