_msize

De RAD Studio
Aller à : navigation, rechercher

Remonter à Alloc.h - Index


Header File

malloc.h

Category

Memory Routines

Prototype

size_t _msize(void *block);

Description

Returns the size of a heap block.

_msize returns the size of the allocated heap block whose address is block. The block must have been allocated with malloc, calloc, or realloc. The returned size can be larger than the number of bytes originally requested when the block was allocated.

Return Value

_msize returns the size of the block in bytes.

Example



 #include <malloc.h>        /* malloc() _msize() */
 #include <stdio.h>            /* printf() */
 int main( )
 {
   int size;
   int *buffer;
   buffer = malloc(100 * sizeof(int));
   size = _msize(buffer);
   printf("Allocated %d bytes for 100 integers\n", size);
   return(0);
 }



Portability



POSIX Win32 ANSI C ANSI C++

+