allocating memory with malloc
Hello,
I am just wondering about this line.
As unsigned int is 4 bytes. Am I creating a block of 3 unsigned int.
So the pointer will contain 3 blocks of unsigned int's?
Code:
ptrVP = (unsigned int*) malloc(NUMBER_OF_PORTS * sizeof(*ptrVP));
Also do I need to dereference the pointer sizeof(*ptrVP)?
Code:
static const unsigned int NUMBER_OF_PORTS = 3;
typedef unsigned int *pVPGroups;
int main(int argc, char** argv)
{
pVPGroups ptrVP;
int size = sizeof(ptrVP);
ptrVP = (unsigned int*) malloc(NUMBER_OF_PORTS * sizeof(*ptrVP));
size = sizeof(ptrVP);
return 0;
}
Many thanks,