/* like this */ if (a = 1) ...
Given a logical expression (like something in an if statement), is there any possible assignment to the variables involved that will cause it to be true?It seems like a simple question, but the best answer people have come up with so far is not much better than "try all possible combinations of true and false," of which there are an exponential number. Problems like this are called NP-complete, and you will run into them if you take later computer science or electrial engineering classes. What does this mean for you? Many problems other than questions about C programs are undecideable or NP-complete, and there are mathematical tools for proving that they are. If your boss ever asks you to write some fast code to solve a certain problem and you think it can't be done, you may be right. You can try to prove that the problem is unsolvable by a computer in a reasonable amount of time. For more information on this and other cool computer science stuff, see the comp.theory Frequently Asked Questions List. (This Extra for Experts section brought to you as a blatant plug for the CS class Analysis of Algorithms and my section in the theory FAQ :-)