fork(1) download
  1. #include <stdio.h>
  2.  
  3. void *stack[1024], **sp = stack;
  4.  
  5. #define CAT_(a, ...) a ## __VA_ARGS__
  6. #define CAT(...) CAT_(__VA_ARGS__)
  7. #define GOSUB(lbl) {*sp++ = &&CAT(L, __LINE__); goto lbl; CAT(L, __LINE__):;}
  8. #define RETURN goto *--sp
  9.  
  10. int main(void) {
  11. int n, f;
  12. scanf("%d", &n);
  13. GOSUB(factorial);
  14. printf("%d", f);
  15. return 0;
  16.  
  17. factorial:
  18. f = 1;
  19. while (n)
  20. f *= n--;
  21. RETURN;
  22. }
  23.  
Success #stdin #stdout 0s 9432KB
stdin
7
stdout
5040