When assigning a type to const, you can only assign literals, for example: 1, 2, 'a', 'b', etc., and not variables such as int x, float y, const int z, etc. Variables, even though your variable is really not a variable (since it cannot change) is not acceptable. Instead, you need to do:
const int x = 123; const int y = 123;
or
#define x 123 const int y = 123;
The second one works because the compiler will be broken wherever x is, and replace it with a literal before compiling it.
source share