I have a program which processes thousands of chemical structures. To keep track of how many are being processed, and to avoid staring at a blinking cursor for minutes not knowing if anything is happening, I included a simple bit of code:
if((MOLNUMBER%10000)==0)
{
fprintf(stderr,".");
}
What could possibly go wrong? Well when it reached entry 200999 it bombed out with a segmentation fault. Thinking it could be the structure there I cut it out and repeated it. This time it bombed out on entry 240999. These were suspiciously round numbers so I decided to cut out this bit of code and the program worked fine, albeit with just a blinking cursor. I'm curious to know why this might be. Haven't included any other code as I can't see how it could clash, unless anyone thinks differently. Why would this code cause a seg fault?