title: Stack around the variable ' ' was corrupted
body: <pre><code>void GameBoard::enterShips()
  {
      char location[1];
      int ships = 0;
      int count = 1;
  
      while(ships &lt; NUM_SHIPS)
      {
          cout &lt;&lt; "Enter a location for Ship " &lt;&lt; count &lt;&lt; ": ";
          cin &gt;&gt; location;
          cout &lt;&lt; endl;
  
          Grid[location[0]][location[1]] = SHIP;
          ships++;
          count++;
      }
  }
  </code></pre>
  
  <p>Im writing a battleship game. I have the board layouts working and the computers randomly generated ships. Now I am working on this method to prompt the user to enter coordinates for the ships When I run the program, it allows me to enter 5 ships. When I enter the 6th ship, it gives me this error.</p>
  
  <blockquote>
    <p>Stack around the variable location was corrupted.</p>
  </blockquote>
  
  <p>Ive looked for answers online and have not found anything exclusive.</p>
  
  <p>Any help would be appreciated.</p>