fork download
  1. #include <stdio.h>
  2.  
  3. struct fxdata {
  4. int foo;
  5. };
  6.  
  7. int function(int n, struct fxdata *p) {
  8. p->foo += n;
  9. return p->foo;
  10. }
  11.  
  12. int main(void) {
  13. struct fxdata f1 = {0};
  14. struct fxdata f2 = {0};
  15. function(10, &f1); // returns 10
  16. function(-4, &f2); // returns -4
  17. printf("%d, %d\n", function(1, &f1), function(-1, &f2));
  18. }
  19.  
Success #stdin #stdout 0s 4392KB
stdin
Standard input is empty
stdout
11, -5