I was going through the code at http://geeksforgeeks.org/?p=10302
#include
int initializer(void)
{
return 50;
}
int main()
{
static i
6.7.8/4 [C99]
All the expressions in an initializer for an object that has static storage duration shall be constant expressions or string literals.
In static int i = initializer();
the RHS is not a constant expression and so the code doesn't compile in C.
In C++ there is no such restriction and the code is well-formed in C++.