S
Sebastian Lipp
Hey There!
I'm trying to get the reverse Polish calculator of the 2nd edition of
The C Programming Language (German translation) working. But something
doesn't work.
The first and second try were a type-out directly from the book. The
third try was fetching the code from [1]. It compiles fine but no matter
what the program complains about an empty stack when calculating the first
result and returns the last given operand:
4*5
error: stack empty
5
9/3
3
6/3
3
100-20
20
2+3+5
5
What's wrong here? Is there a error in the book or a change in the standard
library since 1990 that's relevant here?
[1]: http://users.powernet.co.uk/eton/kandr2/krx400.html
I'm trying to get the reverse Polish calculator of the 2nd edition of
The C Programming Language (German translation) working. But something
doesn't work.
The first and second try were a type-out directly from the book. The
third try was fetching the code from [1]. It compiles fine but no matter
what the program complains about an empty stack when calculating the first
result and returns the last given operand:
4*5
error: stack empty
5
9/3
3
6/3
3
100-20
20
2+3+5
5
What's wrong here? Is there a error in the book or a change in the standard
library since 1990 that's relevant here?
[1]: http://users.powernet.co.uk/eton/kandr2/krx400.html