Pause screen at program completion in C

To do this quick hack, the most common two options are:

/* Windows only */
#include <stdlib.h>

system("pause");

and

/* Cross platform */
#include <stdio.h>

printf("Press enter to continue...\n");
getchar();

I suggest the latter method, though the first method really triggers on “any” key while the bottom one only triggers on enter.

Leave a Comment