fork download
  1. #include <stdio.h>
  2.  
  3. int foo(int x){
  4. static int bar = 0;
  5. return bar += x;
  6. }
  7.  
  8. int main(){
  9. int i = 0;
  10. for(i; i < 10; ++i)
  11. printf("%d\n", foo(i));
  12. return 0;
  13. }
Success #stdin #stdout 0s 2248KB
stdin
Standard input is empty
stdout
0
1
3
6
10
15
21
28
36
45