title: A bunch of questions about C++'s cstring
body: <p>I have a few questions I would like to clarify about cstrings:</p>
  
  <p>1) Initialization:
  When declaring an array of characters as follows, does C++ automatically defines it as a cstring? or (as I believe) an array of characters?</p>
  
  <p><code>char a[10];</code></p>
  
  <p>In other words, is this an array of characters containing only a null terminator ('\0') or is it an empty array of characters?</p>
  
  <p>2) When working directly on a cstring's indexes (<code>i.e. a[i] = ch+1;</code>), does a cstring automatically takes care of its null terminator, or is it the programmer's responsibility to leave space for it and insert it?</p>
  
  <p>Example code (This is what I believe to be the right answer):</p>
  
  <pre><code>char a[10];
  int i = 0;
  cin.get(ch);
  
  while(ch != '\n' || i &lt; 9) {
      a[i] = ch;
      counter++;
      cin.get(ch);
  }
  a[i] = '\0';    //either the last index(9) 
                  //or the one right after the
                  //last input will be set to '\0'
  </code></pre>
  
  <p>3) When using the <code>&lt;cstring&gt;</code> library (like strncpy, strncat, etc.), does it take care of the null terminator? Example:</p>
  
  <pre><code>char myCstring[] = "I am a cstring";  //size of 15 (including '\0' at i == 14)
  strncpy(myCstring, "I am NOT a string object", 14);
  </code></pre>
  
  <p>Will this result in the following array?</p>
  
  <pre><code>| I |   | a | m |   | N | O | T |   | a |   | s | t | r | '\0' |
    0   1   2   3   4   5   6   7   8   9  10  11  12   13   14
  </code></pre>
  
  <p>And lastly:</p>
  
  <pre><code>char myCstring[] = "I am a cstring";  //size of 15 (including '\0' at i == 14)
  strncpy(myCstring, "I'ma cstring", 14);
  </code></pre>
  
  <p>Will this result in the following array?</p>
  
  <pre><code>| I | ' | m | a |   | c | s | t | r  | i | n | g | '\0' |x|x|
    0   1   2   3   4   5   6   7   8    9   10  11   12  13 14
  </code></pre>
  
  <p>Sorry for the mess.</p>