Generic implementation of the stack in C.