I am trying to evaluate a string entered by the user. I want to do something similar to the eval function in Matlab. For example, if the user enters :
p OR NOT q
I would then prompt them for the values of p and q. The user would enter either a 1 or 0 for each, then I would display if the expression is either true or false. I already know how to use the or, and, and not operators in C. My problem is if I trace through the input string and make a new string which would be:
p | ! q
How do I evaluate this expression if it is still a string?
Thanks