title: Char Array in Pointer larger than initialized?
body: <p>I've createed a buffer system, however determining a string read from a buffer is rather difficult compared to C#. Let's consider the following code that creates a char* to an array:</p>
  
  <pre><code>int Size = 6;
  char* String = new char[ Size ]();
  </code></pre>
  
  <p>That'll create the pointer to a brand new array of a specified size. However, if I try to access an index outside of that size, an out of bounds error isn't shown:</p>
  
  <pre><code>String[ Size + 1 ];
  </code></pre>
  
  <p>Instead, for example I could "print" the array as if it were a string:</p>
  
  <pre><code>String[ 0 ] = 'S';
  String[ 1 ] = 'T';
  String[ 2 ] = 'R';
  String[ 3 ] = 'I';
  String[ 4 ] = 'N';
  String[ 5 ] = 'G';
  cout &lt;&lt; String &lt;&lt; endl;
  </code></pre>
  
  <p>However, this will not only print the characters within the original array but also random characters not within the original array, e.g. characters in indexes beyond the bounds of the array: (Example)</p>
  
  <pre><code>STRING&amp;^%(^$$#%$*
  </code></pre>
  
  <p>Instead Of:</p>
  
  <pre><code>STRING
  </code></pre>
  
  <p>Why is this behavior happening and how can I avoid it?</p>