I tried editing other lines of code too, I just open vi, modify a print statement, and recompile (first deleting all .o and .exe of course). When I run it, the program fails to run its functions properly, and the print statement has not been changed. Then I simply type script, and suddenly everything runs perfectly and the printf statement is displayed properly. Then I exit the script, and once again the program misfires and displays the old print statement which has clearly been changed in vi.
This is the same problem I was having a few days ago, where all I was trying to do was create a simple helloworld app. It is apparently saving an old version of the code/executable and running that incorrectly (because it doesn't execute the old code properly at all) unless script is running, in which case it runs the new version correctly (in which only a single printf has been modified, and so there is no reason that the previous version wouldn't run properly as well).
I just can't imagine how this is happening when I am not recompiling anything, and all I am doing is turning script on and off.
One thing I noticed is that I have to exit script -twice-. The first time it says "There are stopped jobs." I don't know what that means but perhaps that is a clue.