I have two questions: Why doesn't the counter get displayed every iteration of the while(!quit) loop. Is there a delay in SDL adding a key event to the queue? The counter gets displayed consistently every 5 iterations. Also, why is there such a delay between the first output of counter and the second?
If there were no delay the loop handling the events would not end for as long as you hold the key down because SDL_PollEvent would continuously give you another SDL_KEYDOWN event.
Repeated SDL_KEYDOWN events are mostly useful for text input and certain GUI actions. If you just want to check if a key is currently hold down you can use the SDL_GetKeyboardState function.