Because anything from C++ and beyond have nice constructs that handles a "stack" like behavior(vectors, lists, array lists, etc), I want to keep the question in terms of C.
So, I am learning about compilers, stacks, inscript and postscript, parsers, lexers, and everything else that involves putting a compiler together as I will be required to later on in the my course for this semester. I want to make sure that my understanding of stacks is solid.
I believe I have the general idea on how one is put together. Basically you have an array following LIFO model. When you add an element, it is "pushed" in on the end of the array and "popped" off when removed. No issue there. My concern comes whith some the implementation detail. How are things like number of elements tracked? How large should a stack be initialized to? Should I use a structure to hold those details together? Are variables global?
My professor has already handed us some source code in relation to our assignment, I am just looking for some supplemental details for my own understanding (generally I have to put something together myself before getting an understanding of someone else's code). In most of my programming experience, the stack was some magical place that was beyond my control, but would explode if my recursive functions got too deep (SO anyone?).
Thanks in advance.
EDIT:
Ok, one thing I think I need to clarify is that I am not making a "true" stack, but will be required to take a an infix epxression and convert it to postfix. I am looking at the stack data structure so anything architecure related may not apply in this since. I was given the impression a stack was the way to handle this, likewise with rule reduction described in BNF notation.