C function void *__cdecl malloc(size_t _Size);
and C++ template class template < class T, size_t N > class array;
both mention the type size_t
.
int *p = (int*)malloc(6*sizeof(int));
statement allocates a memory of 6*sizeof(int) bytes.
However, array<int, 6*sizeof(int)> myArray;
statement allocates a memory of 6*sizeof(int)*sizeof(int) bytes.
I want to know if the first size_t
have the same meaning with the second size_t
.