Declaration of Storage Class
Variables in C have not only the data type but also storage class that provides information about their location and visibility. The storage class divides the portion of the program within which the variables are recognized.
Auto is the default storage class.It is a local variable known only to the function in which it is declared.
Local variable which exists and retains its value even after the control is transferred to the calling function.
Global variable known to all functions in the file.
Social variables which are stored in the register
Defining Symbolic Constants
A symbolic constant value can be defined as a preprocessor statement and used in the program as any other constant value. The general form of a symbolic constant is
# define symbolic_name value of constant
Valid examples of constant definitions are
# define marks 100 # define total 50 # define pi 3.14159
These values may appear anywhere in the program, but must come before it is referenced in the program.
It is a standard practice to place them at the beginning of the program.
Declaring Variable as Constant
The values of some variable may be required to remain constant through-out the program. We can do this by using the qualifier const at the time of initialization.
Const int class_size = 40;
The const data type qualifier tells the compiler that the value of the int variable class _size may not be modified in the program.
Format Specifiers in C
|%c||The character format specifier.|
|%d||The integer format specifier.|
|%i||The integer format specifier (same as %d).|
|%f||The floating-point format specifier.|
|%e||The scientific notation format specifier.|
|%E||The scientific notation format specifier.|
|%g||Uses %f or %e, whichever result is shorter.|
|%G||Uses %f or %E, whichever result is shorter.|
|%o||The unsigned octal format specifier.|
|%s||The string format specifier.|
|%u||The unsigned integer format specifier.|
|%x||The unsigned hexadecimal format specifier.|
|%X||The unsigned hexadecimal format specifier.|
|%p||Displays the corresponding argument that is a pointer.|
|%n||Records the number of characters written so far.|
|%%||Outputs a percent sign.|