There are four storage class modifiers used in C which determine an identifier’s storage duration and
1. The auto storage class is implicitly the default storage class used and simply specifies a normal local
variable which is visible within its own code block only and which is created and destroyed
automatically upon entry and exit respectively from the code block.
2. The register storage class also specifies a normal local variable but it also requests that the compiler
store a variable so that it may be accessed as quickly as possible, possibly from a CPU register.
3. The static storage class causes a local variable to become permanent within its own code block i.e.
it retains its memory space and hence its value between function calls.
4. When applied to global variables the static modifier causes them to be visible only within the
physical source file that contains them i.e. to have file scope. Whereas the extern modifier which is the
implicit default for global variables enables them to be accessed in more than one source file.
Constants are fixed values that cannot be altered by the program and can be numbers, characters or
Some Examples :char : 'a', '$', '7'
int : 10, 100, -100
unsigned : 0, 255
float : 12.23456, -1.573765e10, 1.347654E-13
double : 1433.34534545454, 1.35456456456456E-200
long : 65536, 2222222
string : “Hello World\n”
float f_val ;
double d_val ;
f_val = 123.345 ;
d_val = 123.345 ;
However the value may be coerced to type float by the use of a modifier as follows :f = 123.345F ;
Integer constants may also be forced to be a certain type as follows :100U --- unsigned
100L --- long
Integer constants may be represented as either decimal which is the default, as hexadecimal when
preceded by "0x", e.g. 0x2A, or as octal when preceded by "O", e.g. O27.
Character constants are normally represented between single quotes, e.g. 'a', 'b', etc.
char ch = 97 ;
char ch = 'a' ;
There are also a number of special character constants sometimes called Escape Sequences, which are
preceded by the backslash character '\', and have special meanings in C.