You copied the Doc URL to your clipboard.


Defined in alloca.h, this function allocates local storage in a function. It returns a pointer to size bytes of memory. The default implementation returns an eight-byte aligned block of memory on the stack.

Memory returned from alloca() must never be passed to free(). Instead, the memory is de-allocated automatically when the function that called alloca() returns.


alloca() must not be called through a function pointer. You must take care when using alloca() and setjmp() in the same function, because memory allocated by alloca() between calling setjmp() and longjmp() is de-allocated by the call to longjmp().

This function is a common nonstandard extension to many C libraries.


void *alloca(size_t size);