I have this in my code:
int x = 4;
char* array = malloc(x*sizeof(char));
size_t arraysize = sizeof (array);
printf(\"arraysize: %zu\\n\", arraysize);
sizeof doesn't have a return value because it isn't a function, it's a C language construct -- consider the fact that you can write sizeof array without the parentheses. As a C language construct, its value is based entirely on compile-time information. It has no idea how big your array is, only how big the array pointer variable is. See http://en.wikipedia.org/wiki/Sizeof for complete coverage of the subject.