While reading man page is very useful thing to do, there is also something else that make life a lot easy - compile you program with warnings at least with -Wall and make sure you fixed all warnings....