This is not a "variable", this is a type:
http://www.cplusplus.com/reference/cstring/size_t[
^].
You should use this type to calculate data sizes, not
unsigned long
or anything else.
Also, sizeof *array
is a size of an element, not a size of array. To get a size of array, multiply element size by the number of elements. (You actually correctly get the size of the data to allocate.)
—SA