title: In C programming: Do I need to consider '\0' (null terminator) when mallocing space for a new string
body: <p>For example, suppose I want to copy thing the string "str1" to a new string, "str2": <br/></p>
  
  <pre><code>void function(const char* str1){
      char* str2;
      str2 = (char *) malloc(sizeof(char) * (strlen(str1) + 1));
      strcpy(str2, str1);
      ...
  }
  </code></pre>
  
  <p>Should the argument to malloc be:</p>
  
  <pre><code>sizeof(char) * (strlen(str1)+1)
  </code></pre>
  
  <p>or just: <br/></p>
  
  <pre><code>sizeof(char) * strlen(str1)
  </code></pre>