Use an std::vector
.
std::vector< std::vector<int> > my_array; /* 2D Array */
my_array.size(); /* size of y */
my_array[0].size(); /* size of x */
Or, if you can only use a good ol' array, you can use sizeof
.
sizeof( my_array ); /* y size */
sizeof( my_array[0] ); /* x size */