Monday, January 03, 2011

alloca

alloca (in C) allows you to dynamically allocate memory on the stack!

Here is a example:



Note that using this function isn't really good practice. If there is a stack overflow, the behavour is undefined. But there are advantages of using alloca as well.

Further reading: an alternative to alloca: obstacks

No comments: