// start of Update () keyboard = SDL_GetKeyboardState (&numKeys); if (numKeys > lastNumKeys) { if (lastKeyboard) free ((void *) lastKeyboard); lastKeyboard = (Uint8 *) malloc (numKeys * sizeof (Uint8)); } // end of Update () memcpy ((void *) lastKeyboard, (void *) keyboard, numKeys * sizeof (Uint8)); lastNumKeys = numKeys;