Can someone please explain to me why this simple array program isnt able to store 10 array values from the user? instead it asks for 11 values and then it outputs 10.
My objective is to ask the user for 10 test scores and then print them out in reverse order.
Code:
#include <stdio.h>
int main() {
int index, array[10];
printf("Please enter 10 test scores.\n\n");
for (index=0; index<10; index++)
scanf("%d\n", &array[index]);
printf("Here are the scores in reverse order:\n");
for (index=9; index >=0; index--)
printf("%d ", array[index]);
system ("PAUSE");
return 0;
}
Thank you.