fork download
  1. #include <stdio.h>
  2. void intMaOp(void *lhs, int rhs) {
  3. *(int *)lhs *= rhs;
  4. }
  5.  
  6. void *sideEffect(void *input, void (*maOp)(void *, int)) {
  7. printf("sideEffect\n");
  8. maOp(input, 2); // *(int *)input *= 2;
  9. return input;
  10. }
  11.  
  12. int score99() {
  13. return 99;
  14. }
  15.  
  16. int score() {
  17. int someValue = score99();
  18. return *(int *)sideEffect(&someValue, intMaOp);
  19. }
  20.  
  21. int main() {
  22. printf("score: %d\n", score());
  23. return 0;
  24. }
Success #stdin #stdout 0s 2248KB
stdin
Standard input is empty
stdout
sideEffect
score: 198