Author: Unknown
Subject: Malloc allocates wrong amount of memory
Date: Friday, 17 Apr 2020, 23:41:11
I'm using malloc to allocate a certain amount of memory, but when I print the sizeof() the allocated memory is different.
int newArraySize = 16;
htbl[tablePos] = malloc(newArraySize);
printf("---- %d, %d\n", sizeof(htbl[tablePos]), newArraySize);
which then prints
---- 8, 16
Why would this be happening?
PREV
INDEX
NEXT