In C programming, data types specify the type of data that a variable can store. They tell the compiler how much memory to allocate for a variable and what kind of operations can be performed on it.
Choosing the correct data type is important for efficient memory usage and correct program execution.

A variable is a named memory location used to store data values during program execution. The value stored in a variable can change while the program is running.
int count;
float temperature;
Here, count and temperature are variables of type int and float.
C data types are broadly classified into the following categories:
Basic data types are the fundamental data types provided by C.
| Data Type | Description | Size (Typical) |
|---|---|---|
int |
Stores whole numbers | 2 or 4 bytes |
float |
Stores decimal numbers | 4 bytes |
double |
Stores double-precision decimal numbers | 8 bytes |
char |
Stores a single character | 1 byte |
Derived data types are formed using basic data types. They allow programmers to store multiple values or complex data.
int marks[5]; // Array
int *ptr; // Pointer
User-defined data types allow programmers to create their own data types according to program requirements.
structunionenumtypedefstruct student {
int roll;
float marks;
};
Variable declaration tells the compiler the name and type of the variable.
int age;
float salary;
char grade;
A variable must be declared before it is used in a program.
Initialization means assigning an initial value to a variable at the time of declaration.
int age = 20;
float pi = 3.14;
char ch = 'A';
Proper initialization helps avoid unexpected results during program execution.
Examples of valid variable names: total, _count, sum1
Invalid variable names: 1sum, float, total marks
The size and range of data types depend on the compiler and system architecture. However, approximate values are:
int: −32,768 to 32,767 (2 bytes)char: −128 to 127 or 0 to 255float: 6 decimal precisiondouble: 15 decimal precision