Hello!
Although i am still pretty new here, i think there are quite some things you could do to help your case:
1st: People around here like the Code-Tag very much as it helps to read and understand your code. It may be added as described in
Formatting...
2nd: Even without special options i got two warnings using gcc to compile your code. You might want to take a look at this, because some people might come to the conclusion you have a devil-may-care attitude. If you should have no idea what this warnings are about, don't hesitate to tell us. This way someone may be able to explain.
3dr: You should compile with -Wall option enabled, maybe even with -Wextra. I had to learn the hard way lately that warnings in c are best taken very seriously. In this case, at least one of the warnings in fact is an error, although this is most likely not what is wrong with your program.
I propose you take a look at this. Maybe i take another look at your program tomorrow, but right now i am too tired to do proper debugging...
regards, Heraton