title: Dynamically read user input strings in C
body: <p>Given a user input of unknown length (consisting of words with maximum length 100). Is there a way to read it dynamically string by string?</p>
  
  <p>It is my understanding that scanf reads a string until a space is reached, so I tried using scanf but it enters an infinite loop.</p>
  
  <pre><code>char buf[101];
  while (scanf("%s", buf))
  {
      //something is done with the string
  }
  </code></pre>