I want to know how to make an error message if the user put more numbers than the max value of the array. (the numbers that the user enters should be in the same line)
#include <stdio.h>
#define N 10
int main() {
int arr[10];
int i;
printf("Please enter %d numers\n", N);
for (i=0; i<N; ++i) {
scanf(" %d", &arr[i]);
}
for (i=0; i<N; ++i) {
printf("%d ", arr[i]);
}
return 0;
}
For example in the code that I wrote, the code will just ignore more that 10 numbers, but I want to know how can I make instead an error massage. (is the same if he puts less numbers that I wanted?)
In other words how can I know how many numbers the user entered?