fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. static int x = 0;
  5.  
  6. extern "C" {
  7. static void do_my_pre_init(void) {
  8. x += 10;
  9. }
  10. __attribute__ ((section (".preinit_array"))) void(*p_init)(void) = &do_my_pre_init;
  11. }
  12.  
  13. int main() {
  14. cout << x << std::endl;
  15. // your code goes here
  16. return 0;
  17. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
10