kbhit() does do this, however.
Do you know any function like kbhit() to get know whether ESC is pressed or not.
i.e., it returns true if there's a keypress waiting in the input buffer.
For the most sense, I suggest using EOF to indicate the end of the numbers. Assuming that you don't get any other user input afterwards. EOF can be typed from the keyboard with CTRL-Z on windows and CTRL-D on Linux. You detect for it by checking the return value of getchar() or some other line-buffered single character input function against EOF, or the return value of scanf(), among other ways.
Actually, what I would suggest is using scanf(): that way, the user can type ESCAPE or CTRL-Z or "q" or any invalid number to stop entering numbers.
Code:
int x, rv, c;
while((rv = scanf("%d", &x)) == 1) {
printf("Processing %d\n", x);
}
if(rv != EOF) {
while((c = getchar()) != EOF && c != '\n'); /* strip excess characters from stdin */
}
Something like that.