The C++Course provides a general introduction to programming in C++. It is based on A.B. Downey's book, How to Think Like a Computer Scientist. Click here for details. 
Home Stacks Postfix Expressions  
See also: Expression Trees  
Postfix Expressions
The reason postfix is sometimes useful is that there is a natural way to evaluate a postfix expression using a stack.
As an exercise, apply this algorithm to the expression 1 2 + 3 *. This example demonstrates one of the advantages of postfix: there is no need to use parentheses to control the order of operations. To get the same result in infix, we would have to write (1 + 2) * 3. As an exercise, write a postfix expression that is equivalent to 1 + 2 * 3?


Home Stacks Postfix Expressions 