It appears that you are using equality in your range-top comparison. That is, count <= MAX. You do the same thing in your fibonacci routine. This means it is possible to enter the array size limit as a valid value, but accessing that element of the array is not permitted - arrays go from 0 .. n-1, accessing array[n] is not permitted (although computing that address is valid).

In C, it is "idiomatic" to use non-inclusive ranges in order to accommodate the zero-based nature of arrays. You might find your code "just works better" if you get used to thinking in terms of 0 <= x < max.