I want to return the matrix from the function, but I can't find a way how. I've found some ways, but they can't be used for VLA. I've read about using std::vector, but that also didn't work.
int gengrid(int gridsize)
{
    gridsize = 10 - 1;
    int grid[gridsize+3][gridsize+3];
    srand(time(NULL));
    int count = 0;
    std::fill_n(grid[0], 12, 0);
    for(int i = 1; i < gridsize + 2; i++)
    {
        grid[i][0] = 0;
        for(int j = 1; j < gridsize + 2; j++)
        {
            grid[i][j] = rand()%2;
        }
        grid[i][gridsize+2] = 0;
    }
    std::fill_n(grid[gridsize+2], gridsize + 3, 0);
    return grid;
}
