THE CODERZ TECH LOUNGE
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 ::
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.
1. Static local variables ::
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.
2.Static global variables ::
A static global variable limits access for one file only.
The rest of the usage is same more or less within the rules of scope and visibility. New conventions promote the usage of namespaces and deprecate the use of static variables.
Keywords less used - CodeCall Programming Forum 11June2008
[...] which have values that can be changed by external conditions only. Read the full post here :: Keywords less used | TECHARRAZ __________________ God is real… unless declared an integermy blog :: [...]
2 Static » Blog Archive » Volatile:: 21June2008
[...] Volatile:: Thus we get the numbers from 0 to 9 as output, even though the declaration of ‘aa’ takes place along with the function. 2.Static global variables ::. A static global variable limits access for one file only. #include … [...]