Labels

3/11/08

This is a simple stack implemented in C. It's not dynamic but can easy modified to be.It is just one static table of integer and user can push and pop integers. If you want to make it a dynamic stack you just have to malloc() when push() and realloc() when pop(). You may double the size when push and when items in stack are less than the half size of the stack realloc(). Furthermore you may store in stack void* which mean you can save anything in the stack. Here is the source code of a simple stack of integers.