How do I find the size of a 2D array in C++? Is there any predefined function like sizeof to determine the size of the array?
sizeof
Also, can anyone tell me h
Use an std::vector.
std::vector
std::vector< std::vector > 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 */