fork download
  1. #include <stdio.h>
  2.  
  3. #pragma startup foo1
  4. #pragma exit foo2
  5.  
  6. void foo1()
  7. {
  8. printf("Called before main\n");
  9. }
  10.  
  11. void foo2()
  12. {
  13. printf("Called after main\n");
  14. }
  15.  
  16. int main()
  17. {
  18. printf("main called\n");
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 1720KB
stdin
Standard input is empty
stdout
main called