title: how does scanf() check if the input is an integer or character?
body: <p>I am wondering how does the standard C library function scanf() check if the input is an integer or a character when we call scanf("%d",&amp;var) when a character itself is just a number?
  I know that when it encounters a non-integer it puts it back into the input buffer and returns a -1 but how does it know that the input is not an integer?</p>