fork(2) download
  1.  
  2. #include <stdio.h>
  3.  
  4. int (*compose(int(*f)(), int(*g)()))() {
  5. int h(int x) {
  6. return f(g(x));
  7. }
  8. return &h;
  9. }
  10.  
  11. int dbl(int x) {
  12. return x * 2;
  13. }
  14.  
  15. int sqr(int x) {
  16. return x * x;
  17. }
  18.  
  19. int main() {
  20. printf("%d", compose(dbl, sqr)(5));
  21. return 0;
  22. }
  23.  
Runtime error #stdin #stdout 0s 9288KB
stdin
Standard input is empty
stdout
Standard output is empty