Exercise 2: Debugging
The hints/ex2/ directory contains an implementation of a double-linked list class. The class stores a pointer to the head, and each node (except for the head and the tail, obviously) contains a pointer to the previous and to the next node.
The implementation contains a lot of errors, namely:
- Compilation and syntax errors.
- Runtime errors, including a segmentation fault and a problem in printing the list.
- Memory leaks.
- Two possible segmentation faults, not captured by the
main.
With the help of gdb and valgrind, solve all these issues and make the code working!