sizeof()in memory allocation CXX-S1006
malloc function usually expects a memory size value in units (usually
when allocating any type. Use
sizeof(type) * number_of_values as the size argument
malloc to avoid making mistakes.
It is a good practice to use
malloc and other memory allocation
functions because many types can have variable
size in bytes depending on the platform used.
For instance, many of the default integer types in C & C++ such as, 'int', are platform-dependent.
int* ints = (int*)malloc(64);
int* ints = (int*)malloc(sizeof(int) * 16);