title: Accepting any number of inputs from scanf function
body: <p>I am trying to read an unknown number of inputs using <code>scanf</code> function.</p>
  
  <pre><code>int a[100];
  int i = 0;
  
  while((scanf("%d", &amp;a[i])) != '\n')
   i++;
  
  // Next part of the code
  </code></pre>
  
  <p>But this function is not going to next part of the code, seems like there is an infinite while loop.</p>
  
  <p>How Do I solve this logical error? Is there any other alternatives to <code>scanf</code> like <code>sscanf</code> to read integers into an array?</p>