C Programming Reference >> C Basic Tutorials >> C Keywords Home >> volatileui 30/12/06 - Views - Ratings : 0 of 5 / Votes Its a type specifier. It tells the compiler that variable can get change without explicit specifications. This is imortant because some compilers doesnot assume the value to modify until it occurs on left hand side of the expression in program leading to wrong results. Example of such variable can be the variable used to store system time. Its important to note that volatile is not opposite to constant. A variable can be simulatenously constant and volatile. This make sure value of variable is change only by external hardware means. Code - void function ( void)
{
volatile constant int a = inportb (0X60);
printf ("%d",a);
}
|