See documentation for glutReshapeFunc. Like all the glut*Func() functions this registers a callback function, a function that is called in response to a window system/OS event, so that your application has a chance to handle it appropriately.