Dynamic stack in C