Consider the following code snippet:
int n;
int a[100];
int main()
{
    printf("\nThis program will sort a given list of between 1 and 100 integers.\n\n");
    int ready = 0;
    while(!ready)
    {
        printf("How many integers are in your list? ");
        scanf("%d",&n);
        if(n>100)
        {
            printf("\n\nError:\tToo many integers.\n\tThis program can only handle up to 100 integers.\n\n\n"); 
        }
        else if (n<1)
        {
            printf("\n\nError:\tNot enough integers.\n\tThis program requires at least 1 integer to sort.\n\n\n");
        }
        else ready=1;
    }
}
It works as expected if you enter any integer at the prompt, but If you enter a character, it starts to continually output:
How many integers are in your list?
Error: Too many integers.
       This program can only handle up to 100 integers.
...
...
recurse over and over
Obviously it has something to do with the scanf() function, but I would like to know what goes on under the hood that causes this abstraction to leak the way it does.
I am used to languages with floaties and life jackets and I am trying to get used to swimming in the deeper end of the swimming pool with C.
 
     
    