title: do snprintf() internally call memset() or similar?
body: <p>I'm cognizant of using <code>snprintf()</code> in lieu of <code>sprintf()</code> for safety. However, I always do <code>memset()</code> on buffer used by <code>snprintf()</code>. I saw some codes using the function without <code>memset()</code>. And, it works as expected. I mean there is no overwriting on the buffer. Let me exemplify,</p>
  
  <pre><code>char str[100];
  snprintf(str, sizeof(str), "stackoverflow %zu", sizeof(str));
  fprintf(stderr, "%s\n", str);
  
  snprintf(str, sizeof(str), "soner");
  fprintf(stderr, "%s\n", str);
  </code></pre>
  
  <p>Until now, I thought that the code would print <code>soneroverflow 100</code> that's why I used <code>memset()</code>. Nevertheless, it prints <code>soner</code>. How is it done underhood? By the way, same thing is applied for <code>sprintf()</code>.</p>