fork download
  1. #include <stdio.h>
  2. int ackermann(int m, int n) {
  3. if (m == 0) {
  4. return n + 1;
  5. } else if (m > 0 && n == 0) {
  6. return ackermann(m-1, 1);
  7. } else if (m > 0 && n > 0) {
  8. return ackermann(m-1, ackermann(m, n-1));
  9. } else {
  10. return 0;
  11. }
  12. }
  13. int main(void) {
  14. int m = 4, n = 2;
  15. printf ("Ackermann(%d,%d): ", m, n);
  16. printf ("%d\n", ackermann(m, n));
  17. return 0;
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:1:10: error: #include expects "FILENAME" or <FILENAME>
 #include &lt;stdio.h&gt;
          ^
prog.c: In function ‘ackermann’:
prog.c:5:19: error: ‘gt’ undeclared (first use in this function)
     } else if (m &gt; 0 &amp;&amp; n == 0) {
                   ^
prog.c:5:19: note: each undeclared identifier is reported only once for each function it appears in
prog.c:5:21: error: expected ‘)’ before ‘;’ token
     } else if (m &gt; 0 &amp;&amp; n == 0) {
                     ^
prog.c:7:21: error: expected ‘)’ before ‘;’ token
     } else if (m &gt; 0 &amp;&amp; n &gt; 0) {
                     ^
prog.c: In function ‘main’:
prog.c:15:5: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
     printf ("Ackermann(%d,%d): ", m, n);
     ^
prog.c:15:5: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default]
prog.c: In function ‘ackermann’:
prog.c:12:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
stdout
Standard output is empty