Code:
int c= getchar();
printf ("Please enter dice values: \n");
n = 0;
while (getchar () !=RETURN) {
if (n < 10) {
diceVal[n] = next;
n = n + 1;
}
}
printf ("%d values read into array \n", n);
getchar() wait for a key to be pressed. You read a character before you print anything. Therefore, your program will wait for characters to be entered before printing anything. I suggest you get rid of the first getchar().
And also it's scanning the spaces as characters, and i don't want it to do that, how do i fix that?
Code:
if(c != ' ') { /* ... */ }
I suggest you look at vart's code again, it could be useful.
Code:
for(i = 0;i< 1000;i++)
if(scanf("%d",&diceVal[i]) != 1)
break;
printf("Read %d values", i);