In c, there are some keywords the usage of which is not very clearly defined (in textbooks). But they are an important part of the language. Here are some I could find ::
Volatile::
The keyword volatile is used to specify that the value of a variable can be changed explicitly by a program even in the same expression where no external or explicit change is made in the value of the variable by the program. This, explicit specification of volatility is important because c automatically assumes a variable on the right side of an expression to have a constant value, and refers to that value if future for the same statement.
Thus
d=a+b+c+a*a+d;
will have same values of ‘a’ throughout by default. This is an implicit optimization of all modern compilers. This can also overcome problems of changing compilers, which differ in evaluation rules for expressions.
This is very helpful for ports, which have values that can be changed by external conditions only.
Static ::
1. Static local variables ::
Code:
#include<stdio.h>
int ret()
{
static int aa;
return aa++;
}
main()
{
int a;
for(i=0;i<10;i++)
{
printf("%d ",ret());
}
getch();
}
In this code, the initial value of ‘aa’ is retained each call. Thus we get the numbers from 0 to 9 as output, even though the declaration of ‘aa’ takes place along with the function.
Know further here ::
Keywords less used | TECHARRAZ