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
Suppose you were only allowed to use array then you could find the size of 2-d array by the following way.
int ary[][5] = { {1, 2, 3, 4, 5}, {6, 7, 8, 9, 0} }; int rows = sizeof ary / sizeof ary[0]; // 2 rows int cols = sizeof ary[0] / sizeof(int); // 5 cols