For a stack, the use of stored in order, if the stack pointer when the initialization top as 0, So when do stack operation, should be Data [top++]=x The stack should be Gettop=data [-- top] This way is correct? Why can I see a book is like this O bosses give advice or comments!
CodePudding user response:
This watch your own idea design, you can design as the first one is 0, can be designed into the first one is 1, LUA is such
CodePudding user response:
If, as written in the book, then the stack [0] don't store any data, is directly from the stack [1] is beginning to store
CodePudding user response:
Or that sentence, the design of the interface is provided to outside you bool push (data), bool pop (data), external index, zha operation can be as long as you don't go wrong