What is the value of int count; declared inside a function, before it is assigned?
Automatic variables are not initialised. Their memory holds whatever was there before, and using the value is undefined behaviour in many cases. Always initialise locals.