title: Why is the for printf in this C function not outputting the correct string?
body: <p>I'm trying to write a function that outputs an input string 10 times. Here is the code.</p>
  <pre><code>#include &lt;stdio.h&gt;
  
  int print10times(){
  
      char input[] = &quot;&quot;;
      printf(&quot;Which string would you like to print 10 times? &quot;);
      scanf(&quot;%s&quot;, input);
  
      for (int i=0; i&lt;10; i++){
          printf(&quot;%s\n&quot;, input);
      }
  
      return 0;
  }
  
  int main(){
  
      print10times();
      return 0;
      
  }
  </code></pre>
  <p>The output I'm getting looks like this:</p>
  <pre><code>Which string would you like to print 10 times? Hello
  H
  H☺
  H☻
  H♥
  H♦
  H♣
  H♠
  H
  H
  H
  </code></pre>
  <p>Could someone let me know why this doesn't print &quot;Hello&quot; 10 times?</p>
  <p>Thanks.</p>