Compiling the following code with gcc.
Code :
#include <stdio.h>
const int i = 10;
const int n = i+1;
int main() {
printf("%i\n", i);
printf("%i\n", n);
}
Error :
I get a compile error like below
test.c:3:5: error: initializer element is not constant
const int n = i+1;
^
Compiling with g++ works just fine and prints 10 and 11.
I used gcc 4.9.2