C Variables and Data Types

Variable:  A variable is an entity that has a value and is known to the program by a name. A variable definition associates a memory location with the variable name. A variable can have only one value assigned to it at any given time during the execution of the program. Its value may change during the execution of the program.

a= 20.5;
b= 10;
here, a and b are variables.
variables names are identifiers used to name variables. They are symbolic names given to memory locations. A variable name consists of a sequence of letters and digits, the first character being a letter. The rules that apply to identifiers also apply to variable names.
Examples of valid variable names are:             
A    Abc 1    Stu- data
Class    Employee    12 MAX
Examples of invalid variable names are:
a s – illegal character (‘)
stu data – blank space not allowed
2 Max – first character should be a letter.
Class, marks – comma not allowed.

Basic Data Types: The ‘C’ language supports the following basic data types:

Char – a single byte that can hold one character
int – an integer (Non- decimal Numbers)(2 Bytes)
float – a number with decimal values (4 bytes)
double – number with decimal values (8 Bytes)

Qualifiers: A qualifier alters the characteristics of the data type, such as its size or sign. In ‘C’ you can apply qualifiers to the above data types to get additional data types. The qualifiers that alters the size are ‘short’ and ‘long’.
Short int – integer represented by a lesser number of bits (usually 16)
long int – integer represented by a greater number of bits (usually 32 )
Long double – an extended decimal number.
The exact size of these data types depends on the compiler.

The sign qualifiers are “signed” and “unsigned”
signed short int
signed integer
signed long integer
unsigned short integers
unsigned int
unsigned long integer
signed char
unsigned char
Normally size qualifiers (short and long ) cannot be applied to the data types char and float, and sign qualifiers (signed and unsigned) cannot be applied to float, double and long double.