![]() The stack elements can be easily put into a simple struct: // Individual stack element structĪll the stack needs to do is hold the elements in an array and keep track of the current size: // Stack struct to hold the elements Here is a simple drawing of the stack operations: The act of putting something on top is called a “push” and the act of taking something off is called a “pop”. ![]() You can do two things with a stack, you can either put something on top of it, or you can take something off. So what is a stack you ask yourself? Well, think of what a stack of things is in real life: a pile of items that you can only add things to, and remove things from the top. The CPU in your laptop or PC, your mobile phone and iPad all have one thing in common, they all use stacks, without exception.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |