Skip to content
EMPS intranet

Back to top
Hi!   Hi!           Start program

Try stepping through the code


  Value and type of last evaluated expression: Address of array element: Address of array elementx:  (none)

Your browser does not support the canvas element which will make some the features unavailable.

If you are using Internet Explorer within the University of Exeter try going to the Settings menu (probably the gear shape at the top right of this page), selecting "Compatibility View settings", unchecking "Display intranet sites in Compatibility View" and reloading this page.

Code

 Header...
long factorial(int i){ » if (i>0) return i*factorial(i-1); » return 1; }
...
int main(){ » int n; » long fact; » printf("What number?\n"); » scanf("%d", &n); » fact=factorial(n); » return 0; }
...
Memory

factorial-4()

128
129
130
131
i = 0

factorial-3()

176
177
178
179
i = 1

factorial-2()

224
225
226
227
i = 2

factorial()

272
273
274
275
i = 3

main()

308
309
310
311
n = 1741721233
312
313
314
315
fact = -1767877842

NB: the actual memory address of each variable is the
address shown plus 4293042368 (0xFFE2A0C0).

Show Advanced options

.

Input was:

3

Show output (Before looking at the output, work out what you think it put should be and see if you are right.)

Output

What number?
                                                                                                                                                                                                                                                                       

Validate   Link-check © Copyright & disclaimer Share
Back to top