 <p>You are creating an array that is too small for the loop. Namely: <code>new char[28][31];</code> will only allow for a maximum index of 27 and 30. Your for loops are:</p> <pre><code>for (int i=0; i&lt;=31; i++) for (int y=0; y&lt;=28; y++) </code></pre> <p>Use <code>i&lt;31</code> and <code>y&lt;28</code>, or increase your array to be <code>[29][32]</code>. Either one of these should solve your current problem.</p>