What does the following exactly mean?
void *malloc(size_t size);
int *p=(int*)malloc(23);
Does it mean that the OS allocates a memory of 23 bytes to int(though it requires just 4 bytes)? I know that to make malloc platform independent, we use sizeof, but what if we use the above syntax?
Also, even after writing malloc as above, when I type printf("%d",sizeof(*p))
, I get the answer as 4. Why? Should'nt it return 23 since that's what the memory I allocated?