Hmmn, we'll need to know whether it is overflowing or underflowing the test, then. Try replacing
printf("constraint violated");
with this:
printf("\n\tconstraint violated: ");
if (fill_s[0] < fsi)
{
printf("underflow, %d < %d\n", fill_s[0], fsi));
}
else if (fill_s[0] > fsf)
{
printf("overflow, %d > %d\n", fill_s[0], fsf));
}
else
{
printf("unknown error, program halting.\n");
system("pause");
exit(-1);
}
That will at least tell you more about the problem.