Skip to content

Dynamic Memory Allocation

hengxin edited this page Nov 9, 2017 · 2 revisions

malloc

The <malloc.h> header is deprecated.

C11, 7.22.3.4 The malloc function

The malloc function allocates space for an object whose size is specified by size 
and whose value is indeterminate.
int *sieve = malloc(sizeof *sieve * length);

It's not in the standard.

But there are platform-specific functions to do this, like _msize or malloc_usable_size.

Clone this wiki locally