C Language | Identifiers and Keywords


A variable is a name given to a storage area that our programs can manipulate. Each variable in C has a specific type, which determines the size and layout of the variable’s memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable.

The names given to variables, function, arrays, etc. by the programmers are referred to as identifiers. These are user-defined names and consist of a sequence of letters and digits. Before we decide on a name there are some simple rules we must be aware of.

An identifier has to:

* begin with a letter, or
* begin with an underscore
* it cannot be the same name as built-in keywords
* white spaces are not allowed
* Special characters are not allowed.
* Identifiers are case sensitive i.e. Upper case and lower case are treated differently. i.e. ‘A’ and ‘a’ are different.
* It should not be very lengthy. Should be small enough to recognize the entity which they represent.

Variable Definition in C

A variable definition tells the compiler where and how much storage to create for the variable. A variable definition specifies a data type and contains a list of one or more variables of that type as follows −

datatype variable_list;

Here, datatype must be a valid C data type including char, int, float, double, bool, or any user-defined object; and variable_list may consist of one or more identifier names separated by commas. Some valid declarations are shown here −

int a, b, c;
char name, ch;
float bal, salary;
double x,y,z;

The line
int a, b, c;
declares and defines the variables a, b, and c; which instruct the compiler to create variables named a, b and c of type int.

Variable initialization

Variables can be initialized (assigned an initial value) in their declaration. The initializer consists of an equal sign followed by a constant expression as follows −

type variable_name = value;


int a = 10, b = 25;
float x = 10.45;
char ch = ‘y’;


In a C program, the semicolon is a statement terminator. That is, each individual statement must be ended with a semicolon. It indicates the end of one logical entity.

Given below are two different statements −

printf(“Hello, Computer”);
printf(“Welcome to C Programming);