Difference between Declaration, Definition & Initialisation of a Variable
- AutoEconnect Sessions
- Apr 14
- 1 min read
Updated: Jun 23
In C programming, the terms declaration, definition, and initialisation refer to different stages of a variable's lifecycle.
Understanding the difference is key to writing correct and efficient code.
🔹 1. Declaration
What it is: Tells the compiler that a variable exists, but doesn't allocate memory (unless it's also a definition).
Why it's used: Usually for external variables (defined elsewhere).
Syntax:
extern int x;
Memory allocated? ❌ No
Value assigned? ❌ No
🔹 2. Definition
What it is: Allocates memory for the variable. If not declared before, it's also treated as a declaration.
Why it's used: To actually create the variable.
Syntax:
int x; // Definition (and declaration, if not done before)
Memory allocated? ✅ Yes
Value assigned? ❌ No (value is indeterminate if uninitialised)
🔹 3. Initialisation
What it is: Assigning an initial value to a variable at the time of definition.
Why it's used: To start the variable with a known value.
Syntax:
int x = 10;
Memory allocated? ✅ Yes
Value assigned? ✅ Yes
✅ Summary Table

Comments