title: Printing string using printf without null character
body: <p>I participated Google Code Jam 2019 Round 1C yesterday. Below was the part of the code.</p>
  
  <pre><code>char str[5]={r1,r2,r3,r4,r5};
  printf("%s\n", str);
  </code></pre>
  
  <p>The judge gave Wrong Answer. But if I add the line <code>str[5]='\0';</code> before print statement, It works. </p>
  
  <p>Actually I checked running the program and it seems to be printing normally. Then, may I know why the judge is giving Wrong Answer and where It could have gone wrong? Can anyone please help by telling me the difference of printing string with null character and without null character? Can someone confirm if it will give always correct result?</p>