Look at your code:
table = new int* [18];
for (int i = 0; i < 18; i++)
{
table[i] = new int[15];
}
for (int i = 0; i < 15; i++)
{
table[i][17] = 10 + i % 2;
}
Look at it closely, and see what you are doing:
table = new int* [18];
You create an array of 18 pointers to integers: that's one dimension.
for (int i = 0; i < 18; i++)
{
table[i] = new int[15];
}
You fill in each pointer with an array of 15 integers.
for (int i = 0; i < 15; i++)
{
table[i][17] = 10 + i % 2;
}
You go through the first 15 elements of the outer array, trying to set element 17 of the inner array (which contains 15 elements) to a value ...
If you want to create a 18 * 15 jagged array and fill it, use a nested loop:
int** table = new int*[18];
int x = 0;
for (int i = 0; i < 18; i++)
{
table[i] = new int[15];
for (int j = 0; j < 15; j++)
{
table [i][j] = x++;
}
}