Skip to content
EMPS intranet

Back to top
Hi!   Hi!           Start main()

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){
  ...
» long fact1; » static int depth; » ++depth; // Print depth information for debugging // for(int d = 0; d <= depth; ++d) // fprintf(stderr, " "); // fprintf(stderr, "i: %d (depth %d)\n", i, depth); // If we have gone too deep abort the program » assert(depth<12); » if (i>1) { » fact1=i*factorial(i-1); » --depth; » return fact1; } » --depth; » return 1;
} int main(){
  ...
» factorial(3); » return 0;
}
Memory

Static variables

128
129
130
131
factorial:
depth =
0

factorial-3()

264
265
266
267
268
269
270
271
fact1 = 1
?
?
?
?
288
289
290
291
i = 1

factorial-2()

328
329
330
331
332
333
334
335
fact1 = 1
?
?
?
?
352
353
354
355
i = 2

factorial()

392
393
394
395
396
397
398
399
fact1 = 1
?
?
?
?
416
417
418
419
i = 3

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

Show Advanced options

.
                                                                                                                                                                                                                                                                       

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