Size of malloc'd?
- From: "bwaichu@xxxxxxxxx" <bwaichu@xxxxxxxxx>
- Date: 29 Aug 2006 11:20:48 -0700
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?
.
- Follow-Ups:
- Re: Size of malloc'd?
- From: Eric Sosman
- Re: Size of malloc'd?
- From: bert
- Re: Size of malloc'd?
- Prev by Date: Re: Buffer or Realloc?
- Next by Date: Re: Size of malloc'd?
- Previous by thread: c code reusability
- Next by thread: Re: Size of malloc'd?
- Index(es):
Relevant Pages
|