Open In App

alloca() function its advantages and disadvantages

What is alloca() function?

The function alloca() is used to allocate memory for a stack frame. It’s just an unconventional method of dynamically allocating memory. When a function returns its value or the defined memory’s scope expires, the memory is automatically released.



A void pointer pointing to the beginning of the allocated memory is the result of this function. Even if we just allocate memory with a size of 0, it will still do so and return the void pointer for that starting location.

Advantages of alloca() function:



Disadvantages of alloca() function:

Article Tags :