I am writing this code:
int b;
char c;
scanf("%d", &b);
while((c = getchar()) != EOF) {
    if(c >= 9 || c < 0) {
        printf("Invalid number!\n");
        exit(0);
    }
}
When I assign b, automatically c is equal to b.
For example, if my input for b is 10, it automatically goes into the if-statement and exits the code.
Does anyone know why?
 
     
    