Grab a buggy version of bagsimple and compile it:

$cp -r /thayerfs/courses/22spring/cosc050/workspace/buggybag .
$cd buggybag/
$make

The buggy version of bagsimple.c tries to insert student_t struct into bags and then print the inserted items.

Run bagsimple executable with a dummy names.txt in the same directory, and see what happen.

$./bagsimple < names.txt

Not as you expected, huh?

Then work in groups to track down all bugs, with the help of gdb and valgrind.

Discuss possible solutions to fix these bugs.

Solution

Candidate solution