Improved exercise: ex4-12.c