I was running some C code that drove a stepper motor. The general flow was that it would take user input for the number of steps, maximum speed, and acceleration (scanf commands). Then it would go through a set of whiles and ifs that would generate the profile. It would then activate the stepper motor, wait 0.5s, run the profile, wait another 0.5s, and repeat the whole process from the beginning. It was an infinite while-loop, and the way I would end the program was with Ctrl-C.
One day, I absentmindedly closed out of the command line without Ctrl-Cing out of my code. To my great surprise, it instantly began to run the last profile I had set. It then kept on running that profile, over and over, until I rebooted my Pi.
Why did this happen?
I am using the default Raspbian distro (current as of December 2015, I think) on a Pi 2B with WiringPi.
EDIT:Turned out I didn't have error handling for Ctrl-C. Also, my scanf read into variables, which were reset by the scanf's. If the scanf's were skipped, then I would get the observed symptoms of just running the profile over and over again.