Keywords are the words whose meaning has already been explained to the C compiler. They have a specific meaning and they implement specific C language features. Keywords can be used only for their intended purpose. They cannot be used as names for variables or other user-defined program elements. The following is the list of 32 reserved words (keywords) in C. A few of them are explained below.
const can be used to declare constant variables. Constant variables are those variables which once initialized, can’t change their value which means the value assigned to them remains unmodified.
The static keyword is used to declare static variables. These variables have a property of preserving their value even after they are out of their scope. Hence, static variables preserve the value of their last use in their scope. So they are initialized only once and exist till the termination of the program. This means that no new memory get allocated as they are never re-declared. Their scope is local to the function to which they were defined. Global static variables can be accessed anywhere in the program. By default, they are assigned the value 0 by the compiler.
If extern is used to declare a variable, then it means that the variable is defined elsewhere and not within the same block where it is used. So an extern variable is nothing but a global variable initialized with a legal value where it is declared in order to be used elsewhere. It can be accessed within any function/block of the program.
Void is a special data type only. Void means an empty data type. It means it has nothing or it holds no value. When it is used as the return data type for a function, it simply represents that the function returns no value.
It is used to create a new data type which is equivalent to the existing data type. From then, the new data type can be used to declare variables.
A variable is an identifier used to represent a single data item whose quantity (or) value may vary during program execution. Variable names are the names given to memory locations where the values are stored. In C language, the data type associated with a variable cannot change. The data item corresponding to the variable can be accessed by simply mentioning the name of the variable.
But before using variables in the program, the compiler should be informed well in advance about two things
A Type Declaration statement takes care of informing these to the compiler. The general syntax for a Type declaration statement: