exercise 3 and 4 completed, using a pointer AHEAD of the current