The program below is from a book I'm using to learn programming. While I understand almost every aspect of the code. I have a question.
The program below is meant to implement a Reverse Polish Notation. They use Stack classes to implement the same. The part where I'm confused is ..
In the program you see the name of the stack as "nums"
Now lets say I add another stack class. Although I have commented the second stack class, if I do not comment the second stack class and use the second stack class "numstest" as well, how does the program know the "input_str" is related to the "nums" stack and not the "numstest" stack?
As far as i see, the input string, "input_str" is assigned to the pointer *p.
But I can't see where and how the stack class "nums" is linked to the pointer or the input string. Could anyone open my eyes and show me what I'm missing please?
Thank you Hirokachi, but if I have two stacks, how do I know which stack is responsible for holding the input data ? That is the part that confuses me, Because I don't see any line in the code where the input data/string (input_str) is assigned to a stack.