The problem with scanf() is that's it's basically mindless. If you put in %d for the format specifier, it will happily wait for that number - you can press enter until the cows come home, basically.
There are probably ways around that problem with scanf() specifiers, but scanf() just doesn't strike me as being good for flexible user input.
I would do it something like this:
Code:
#include <stdio.h>
#include <stdlib.h>
int main () {
char buff[20];
int n, x = 0;
int numbers[10];
do {
fgets(buff, sizeof(buff), stdin);
numbers[x++] = atoi(buff);
}while(buff[0] != '\n');
--x;
printf ( "\n You entered %d numbers", x );
for ( n = 0; n < x; n++ ) {
printf ( "\n%d", numbers[n] );
}
printf("\n\n\t\t\t press enter when ready");
x = getchar();
return 0;
}
Try that and see what you think.