Read integer
Since scanf() returns EOF
when end-of-file is reached while reading,
this while-loop read one integer to x
until it reaches end-of-file.
EOF
usally defined as -1, and ~(-1) == 0
.
So when scanf() reads EOF
, which indicates end-of-file, that while-loop terminates.