Find limit of recursion: Difference between revisions

{{header|BASIC}}
(Go solution)
({{header|BASIC}})
Line 116:
set /a c=%1-1
echo [Level %c%] No good</lang>
 
=={{header|BASIC}}==
==={{header|ZX Spectrum Basic}}
On the ZX Spectrum recursion is limited only by stack space. The program eventually fails, because the stack is so full that there is no stack space left to make the addition at line 110:
<lang zxbasic>
10 LET d=0: REM depth
100 PRINT AT 1,1; "Recursion depth: ";d
110 LET d=d+1
120 GO SUB 100: REM recursion
130 RETURN: REM this is never reached
200 STOP
</lang>
 
Output (from a 48k Spectrum):
 
Recursion depth: 13792
4 Out of memory, 110:1
 
=={{header|C}}==