Postfix evaluation in C

Posted by Andrewziac on Stack Overflow See other posts from Stack Overflow or by Andrewziac
Published on 2011-11-12T17:28:23Z Indexed on 2011/11/12 17:51 UTC
Read the original article Hit count: 141

Filed under:
|
|

I’m taking a course in C and we have to make a program for the classic Postfix evaluation problem. Now, I’ve already completed this problem in java, so I know that we have to use a stack to push the numbers into, then pop them when we get an operator, I think I’m fine with all of that stuff. The problem I have been having is scanning the postfix expression in C. In java it was easier because you could use charAt and you could use the parseInt command. However, I’m not aware of any similar commands in C. So could anyone explain a method to read each value from a string in the form:

4 9 * 0 - =

Where the equals is the signal of the end of the input.

Any help would be greatly appreciated and thank you in advance :)

© Stack Overflow or respective owner

Related posts about c

    Related posts about homework