Here’s a great page to read …
http://www.c4learn.com/data-structure/basic-stack-concept/
I can not take snippets from it – as it’s full of images and done in a good way to fully understand stacks and how they work.
This will then allow you get to grips with the code you posted in your question.
solved Stack data structure in c explanation [closed]