how to exit a program via a glut menu

I am using the glut menus, and i dont know the function of item to use to make the program close. I am trying:

void choiceMain(int selection){
if (selection == 1) {
//other menu options that work fine

and of course the function(choiceMain) is registered in the main method, cuz the other 2 menu options work fine. I just dont know how to make a menu function to exit the program! :mad:
the statement “exit;” doesnt call any compile/link errors, but it doesn’t do anything either. Help!

if you created the window with:
window = CreateWindow(title);
then you can destroy your window using:
Greetz Hylke

friend helped me, i feel dumb now:

instead of “exit;”

i needed “exit(0);”