C语言中的const和voliate关键字

const:
The qualifier const can be applied to the declaration of any variable to specify that its value
will not be changed. For an array, the const qualifier says that the elements will not be altered.
const double e = 2.71828182845905;
const char msg[] = "warning: ";

The const declaration can also be used with array arguments, to indicate that the function
does not change that array:
int strlen(const char[]);


voliate:
优化器在用到这个变量时必须每次都小心地从内存重新读取这个变量的值,而不是使用保存在寄存器里的备份。



ATT:《内联、联合体及Voliate.doc》

你可能感兴趣的:(Const)