B
bwaichu
How do I determine the size of a previously malloc'd buffer?
char *buffer;
buffer = calloc(18, sizeof *buffer);
I cannot do a sizeof(buffer) since it would only return the size of the
pointer. I cannot do sizeof *buffer since it would only return the
size of the pointer type. Is there a right way to do this? Do I need
to manage this information in the program?
char *buffer;
buffer = calloc(18, sizeof *buffer);
I cannot do a sizeof(buffer) since it would only return the size of the
pointer. I cannot do sizeof *buffer since it would only return the
size of the pointer type. Is there a right way to do this? Do I need
to manage this information in the program?