fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void cal(int x, int y, int *sum, int *diff, int *mul, int *mod);
  5.  
  6. int main(void) {
  7. int x, y, sum, diff, mul, mod;
  8.  
  9. x = 4;
  10. y = 2;
  11.  
  12. cal(x, y, &sum, &diff, &mul, &mod);
  13.  
  14. printf("x = %d, y = %d\n", x, y);
  15. printf("sum = %d\n", sum);
  16. printf("diff = %d\n", diff);
  17. printf("mul = %d\n", mul);
  18. printf("mod = %d\n", mod);
  19.  
  20. return 0;
  21. }
  22.  
  23. void cal(int x, int y, int *sum, int *diff, int *mul, int *mod) {
  24. *sum = x + y;
  25. *diff = abs(x - y);
  26. *mul = x * y;
  27. *mod = x / y;
  28. }
Success #stdin #stdout 0.01s 5256KB
stdin
Standard input is empty
stdout
x = 4, y = 2
sum = 6
diff = 2
mul = 8
mod = 2