glIdleFunc() for animation??

May I know how to declare glIdleFunc() in my main method? I have a void animation(void) { } method. Then I’ll call the method by pressing a keyboard. But it occurs error with the glIdleFunc(animation()). So, how would I need to declare it??? Please guide me. Thanks!


I solved the problem. But now I don’t know how to use the sleep() function. Can anyone help me asap please? Thanks!