C Data Types

C Data Types (Complete Tutorial: Beginner → Advanced)
In C Data Types define:
what kind of data a variable can store
how much memory it occupies
what operations can be performed
They are one of the most important fundamentals for programming, exams, and interviews.
What is a Data Type?
A data type specifies the type of value a variable can hold.
Classification of Data Types in C
They are divided into four main categories:
Basic (Primitive) Data Types
Derived Data Types
User-Defined Data Types
Void Data Type
Basic (Primitive) Data Types
These are the core data types in C.
int – Integer
Stores whole numbers.
Size: usually 4 bytes
Range: −2,147,483,648 to 2,147,483,647
float – Floating Point
Stores decimal numbers (single precision).
Size: 4 bytes
Precision: ~6 digits
double – Double Precision
Stores large decimal numbers.
Size: 8 bytes
Precision: ~15 digits
char – Character
Stores single character.
Size: 1 byte
Stored as ASCII value
Type Modifiers (Extended Data Types)
Used to modify range and size.
| Modifier | Example |
|---|---|
short | short int a; |
long | long int b; |
signed | signed char c; |
unsigned | unsigned int d; |
Derived Data Types
Derived from basic types.
Array
Pointer
Function
User-Defined Data Types
Created by programmers.
struct
union
enum
typedef
Void Data Type
Represents no value.
Function Returning Nothing
Void Pointer
- Can point to any data type
Boolean Data Type (C99)
true→ 1false→ 0
Size of Data Types (Example)
Common Format Specifiers
| Data Type | Specifier |
|---|---|
int | %d |
float | %f |
double | %lf |
char | %c |
string | %s |
Common Mistakes
- Using wrong format specifier
- Assuming same size on all systems
- Confusing
floatanddouble Forgetting&inscanf()
Interview Questions (Must Prepare)
What are data types in Ity, ?
Difference between
int,float, anddoubleWhat is derived data type?
Difference between
structandunionWhat is
voiddata type?Size of
charin C?
Summary
- Data types define type, size & range of data
- It has basic, derived, and user-defined types
- Correct data type improves performance & safety
- Fundamental for DSA, system programming & interviews
