fork(1) download
  1. #include <stdio.h>
  2. int function(int n) {
  3. static int foo = 0;
  4. foo += n;
  5. return foo;
  6. }
  7.  
  8. int main(void) {
  9. function(10); // returns 10
  10. function(-4); // returns 6
  11. printf("%d, %d\n", function(1), function(-1)); // UB; functions call mess with each other
  12. }
  13.  
Success #stdin #stdout 0s 4508KB
stdin
Standard input is empty
stdout
6, 5