// define the "before main" function int x = 0; __attribute__((constructor)) static void run_before_main_func(void){ x = 100; } // main #include int main(){ printf("x = %d\n", x); return(0); }