C Variables C

A variable can be defined as a quantity, which may vary during program execution.

The name given to the memory location which stores the quantity is called variable name. There are certain rules, which must be followed while naming a variable. A variable name can be any combination of alphabets, digits or underscores. The length of variable name can range from 1 to 8. The first character of the variable name must be an alphabet. No commas or blanks are allowed within a variable name and no special symbol other than underscore can be used. ‘C’ is a case sensitive language i. e. variable name ‘NAME’ and ‘name’ are different variables.

Variable Declaration
Declaration is the place where the nature of the variable (i. e. type of variable) is stated but no storage is allocated. Definition refers to place where the variable is created or stored.

Any variable must be declared before we use it. The variable is declared as follows

Storage – class data – type variable – name;

Let us keep the storage-class part aside right now. We will consider it later.

Data – type variable – name;

E.g.

char basal;
float cd;

Meaningful names must be given to variables. Two or more variables of the same type can declare separating them with comma.

E. g.

int m, m_hra;

Thus declaration specifies a type and contains a list of one or more variables of that type.

Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

C Topics