To follow up what helios said, I recommend that you use constants throughout so that you aren't getting mixed up. Use the same constant for array creation as you do within the loops.
For instance, consider the following code. I didn't compile that but I think you'll get the idea and you can apply it to your example with the 2D array.
1 2 3 4 5 6 7 8 9 10
constunsignedint SIZE(10); // use whenever you want to prevent buffer overflow
int SomeArray[SIZE];
std::generate(SomeArray, SomeArray + SIZE, rand); // fill with random values
// loop and print.
for(int i = 0; i < SIZE; ++i)
{
std::cout << SomeArray[i] << " , ";
}
std::cout << std::endl;