Let me try to answer your questions.
- Yes. There is no reason why you can’t.
- You need to write some sort of lexer to turn the expression into tokens. Then you can use the shunting yard algorithm to turn the expression into something you can easily evaluate.
- Use the result from (2) and evaluate it in a little stack machine. Set each free variable to all possible combinations to generate a truth table.
Parsing arbitrary languages is not possible in general. A good introduction into compiler construction (which is the subfield you are interested in) is found in the Dragon Book (Compilers: Principles, Techniques, and Tools). It’s a large field though, I recommed you to take a compiler construction class.
Also, consider ditching Turbo C for something recent. Turbo C is ancient and full of weird quirks.
solved how can I create a truth table in turbo c [closed]