How does the const qualification on variables differ in C and C++?
from: Does "const" just mean read-only or something more?
\"What prompted this q
const in C cannot be used to build constant expressions.
const
For example :
#include int main() { int i = 2; const int C = 2; switch(i) { case C : printf("Hello") ; break; default : printf("World"); } }
doesn't work in C because case label does not reduce to an integer constant.