Presumably, you’re using some library that provides keyboard input, such as GLUT. When your setting up the windows and other stuff, you’ll specify this function as the keyboard callback. When the library finds out that a keyboard event happened, it calls this function. When this function is done, it returns back to the library.