Multidimensional array complies but fails to run

#include <iostream>
using namespace std;

void arrays(string location[19][19]);
string location[19][19];

int main()
{
arrays(location); //This simple function fails.
//Its probably an easy fix, but i can't find it.
}
void arrays(string location[19][19])
{
for (int x = 0; x < 20; x++)
for (int y = 0; y < 20; y++)
location[x][y] = "-";
}
Last edited on
Fix:
Your an idiot (this is how i expected you guys to reply to me). Change all of the 19s to 20s. Done.

Reason:
location[x][y] runs until location[19][0]. location[19][0] would be the 20th value of the array, but the array is set for [19] values.
Last edited on
Topic archived. No new replies allowed.