fork(3) download
  1. #include <stdio.h>
  2.  
  3. int factorial(int n)
  4. {
  5. int fallback = 1;
  6.  
  7. /* This breaks if you remove the comment,
  8.   * so leave it in.
  9.   */
  10. if (n == 0) { /* Handle 0! specially.
  11.   n = 1; * 0! is the same as 1!.
  12.   return factorial(n); */
  13. } else {
  14. return n * factorial(n - 1);
  15. }
  16.  
  17. return fallback;
  18. }
  19.  
  20. int main(void) {
  21. printf("%d\n", factorial(0));
  22. }
  23.  
Success #stdin #stdout 0s 4340KB
stdin
Standard input is empty
stdout
1