If the program suddenly takes over and starts having a mind of it's own, it's probably a segmentation fault. Check to see that you have enough memory allocated for all your variables. But, uh, your code is a little jumbled. Try organizing it into separate functions, and try indenting every time you hit a { and backspacing every time you hit a }. It'll make it a lot more readable.
|