-next-
What Are Events?

Less Simple Example

event = NONE;

do
{
  if ( there_is_an_event_in_the_queue() )
    {
      event = get_next_event();

      if (event == KEYPRESS)
        printf("You pressed a key\n");
    }
}
while (event != QUIT);

This example is similar, but every time you press a key, it displays a message.