C VARIABLES

A variable is a named memory location, which holds a data value of a particular data type.

The value of variable can be changed throughout the program.

Declaration of a variable:

Syntax:

data_type variable_name;

Example:

int num;
double value;
float sum;

Initialization of a variable: 

Syntax:

data_type variable_name = value;

Example:

int num = 5;
double value = 3.2;
float sum = 15.6;

Variable Scope: Scope generally refer to the program region within which a variable is accessible.

The broad rule is a variable is accessible within the set of braces it is declared.

Syntax:

{
    int num = 5;
    ...........
}