finish ex-2.c for cover.c but [valgrind failed]