Create a new directory and copy the files in
~kelliher/pub/cs23/gdblab to it.
Working in the directory you created, compile the non-pointer version
of the program:
g++ -g -o max main.cc large.cc
For your test runs, enter 2 values: 4 and 5 (entered in that order).
Run the program. It will seg fault. Use gdb to locate the problem
and then you should correct the problem.
You will now note that the answer is wrong. Again, use gdb to
locate and correct the problem.
Now, compile the pointer version of the program:
g++ -g -o max -DPOINTERS main.cc large.cc
Run the program. It will seg fault. Use gdb to locate and correct
the problem.
Re-compile the non-pointer of the program. Run it under gdb, setting
a breakpoint at MaxArray. Enter 5 values. Draw a call diagram
showing which invocations of MaxArray called which, keeping track of the
values of begin and end in each call. (This diagram will be a
binary tree.)
Thomas P. Kelliher
Sat Feb 22 12:05:59 EST 1997Tom Kelliher