Patrick_Geo7
Patrick_Geo7

Reputation: 3

A function to close console window based on user input

I am writing a code for Dots and boxes game in C and I need a function that exit the game and close the window based on an input from the user for example when he presses the letter 'e' on keyboard the game should close and I have no idea how to do that

Upvotes: 0

Views: 90

Answers (1)

arutar
arutar

Reputation: 1093

There are also predefined exit codes EXIT_SUCCESS and EXIT_FAILURE

#include <stdlib.h>

...
    exit(0);
...

e.g. exit(EXIT_SUCCESS);

Upvotes: 1

Related Questions