Dynamic vector based list/stack operations in C