fork download
  1. #include <stdio.h>
  2.  
  3. struct point {
  4. int x, y;
  5. };
  6.  
  7. void f1(int _x, int _y, struct point* p) {
  8. p->x = _x;
  9. p->y = _y;
  10. }
  11.  
  12. struct point* f2(int _x, int _y, struct point* p) {
  13. f1(_x, _y, p);
  14. return p;
  15. }
  16.  
  17. int main(void) {
  18. struct point p;
  19. f1(3,3,&p);
  20. printf("x:%d y:%d\n", p.x, p.y);
  21. f2(1,1,&p);
  22. printf("x:%d y:%d\n", p.x, p.y);
  23.  
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 2160KB
stdin
Standard input is empty
stdout
x:3 y:3
x:1 y:1