// #define _XOPEN_SOURCE 700 // for M_PI and lots of other stuff #include #include // const double pi = 4*atan(1); // no, static initializer must be a constant expression volatile const double pi; void f( void) { printf( "f: pi = %g\n", pi); } void g( void); // in file g.c int main( void) { // ++pi; // should not be allowed // printf( "pi = %g\n", pi); double *p = (double *) π *p = 4*atan(1); f(); g(); // printf( "M_PI = %g\n", M_PI); } /* sample run: $ alias GCC gcc -std=c11 -pedantic -Wall $ GCC pi.c g.c $ ./a.out f: pi = 3.14159 g: pi = 3.14159 $ */