#include <stdio.h>
int b(){
return 5;
}
int main(){
static int a = b();
return 0;
}
Above code doesn't compile in C with this error:
error: initializer element is not a compile-time constant
but compiles fine in C++. What are the differences between initializing static values in C and C++?