Q: I just typed in this program, and it's acting strangely. Can you see anything wrong with it?
A: See if you can run lint first (perhaps with the -a, -c, -h, -p or other options[footnote] ). Many C compilers are really only half-compilers, taking the attitude that it's not their problem if you didn't say what you meant, or if what you said is virtually guaranteed not to work. (But do also see if your compiler has extra warning levels which can be optionally requested.)
See also questions 16.5, 16.8, and 18.7.
References:
Ian Darwin, Checking C Programs with lint