title: C++ string array & Accessing chars
body: <p>In C++, I'm trying to create string array. And also I want to access chars and change them like this:</p>
  
  <pre><code>#include&lt;iostream&gt;
  
  using namespace std;
  
  int main(){
      int n;
      cin &gt;&gt; n;
      char lines[4][n+1];
      int color = 0;
      for(int a = 0; a &lt; n; a++){
          for(int i = 0; i &lt; 4; i++){
              lines[i][a] = (char) (color % 25 + 97);
              if(i == 1 || i == 3){
                  color++;
              }
          }
      }
      cout &lt;&lt; lines[0] &lt;&lt; endl &lt;&lt; lines[1] &lt;&lt; endl &lt;&lt; lines[2] &lt;&lt; endl &lt;&lt; lines[3];
      return 0;
  }
  </code></pre>
  
  <p>When i want it to print all of "lines[i]" there appears some unknown characters.</p>
  
  <p>Expected:</p>
  
  <blockquote>
    <p>aceg</p>
    
    <p>aceg</p>
    
    <p>bdfh</p>
    
    <p>bdfh</p>
  </blockquote>
  
  <p>Output:(<a href="http://i.stack.imgur.com/SR4Y4.png" rel="nofollow">http://i.stack.imgur.com/SR4Y4.png</a>)</p>
  
  <blockquote>
    <p>aceg'aceg■bdfh</p>
    
    <p>aceg■bdfh</p>
    
    <p>bdfh</p>
    
    <p>bdfh</p>
  </blockquote>
  
  <p>Do you know the reason? (I checked my whole code many times, it causes something i don't know about array of char arrays I thought)</p>
  
  <p>Are there any other ways to do this? (<strong>If possible</strong> without libraries like its in C)</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I added all of my code to this message.</p>