title: questions about a function that act like scanf
body: <p>I am wondering about the function below.</p>
  
  <pre><code>inline int nextInt()
  {
      register int s = 0, ch;
      for (ch = getchar(); ch &lt; '0' || ch &gt; '9'; ch = getchar());
      for (s = ch - '0', ch = getchar(); ch &gt;= '0' &amp;&amp; ch &lt;= '9'; ch = getchar())
          s = s * 10 + ch - '0';
      return s;
  }
  </code></pre>
  
  <p>I know that this function behaviors scanf function-like by returning the integer value. However, I didn't understand the function's detailed procedure because many variables are in for loops and it is a little bit confused to me to understand correctly. Even though I copied and pasted them on my visual studio and see each value in variables by printf, but I failed to know what they are doing.</p>
  
  <p>Could you explain above codes to me about what they are doing line by line?</p>