I thought that the following code would work. However, it is printing the first row and then throwing a segmentation fault.
const unsigned **grid = new const unsigned*[10]{new const unsigned[10]{0}};
for (int r = 0; r < 10; r++)
{
for (int c = 0; c < 10; c++)
{
std::cout << grid[r][c] << " ";
}
std::cout << std::endl;
}
Does anyone know what I am (probably naively) doing incorrectly?