C Variables – Examples

C Variables – Examples (Beginner → Practical)
In C language, a variable is used to store data (values) that can change during program execution.
Below are clear, practical examples of C variables, exactly as expected in exams, interviews, and real coding.
Integer Variable Example
- Stores whole numbers
Float Variable Example
- Stores decimal values
Double Variable Example
- Stores high-precision decimals
Character Variable Example
- Stores single character
Multiple Variables Example
- Multiple variables in one line
Variable Declaration vs Initialization
or
- Both are valid
Updating Variable Values
- Variable value can change
Variable with User Input
- Value taken at runtime
Variables in Expressions
- Used in calculations
Local vs Global Variable Example
- Local → inside function
- Global → outside function
Constant Variable Example
- Value cannot change
Variable with Pointer Example
- Pointer accesses variable value indirectly
Common Mistakes
- Using uninitialized variables
- Wrong format specifier
- Forgetting
&inscanf() Confusing variable name with value
Interview Questions (Must Prepare)
What is a variable?
Difference between declaration and initialization
What is local and global variable?
Can variable value change during execution?
What is a constant variable?
Summary
- Variables store values in memory
- Values can change during execution
- Must be declared before use
- Data type defines stored value
- Essential for all C programs & interviews
