First of all, your value
variable is too large and it's overflowing. You can check the largest value it can have by running this code:
#include <limits.h>
int main() {
printf("INTMAX = %d\n", INT_MAX);
return 0;
}
(More on this topic here).
On a typical 32-bit machine this will output INTMAX = 2147483647
. That would mean that your number is actually silently converted to 287551913.
Apart from this, I don't see how changing the initial value of count
could affect the termination of the loop. I would say your code is doing something else, which you are not showing, and that is responsible for that. The code here runs fine on ideone.com:
#include <stdio.h>
#include <limits.h>
int main(void) {
int count = 0;
int value = 3879418911067976105;
printf("INTMAX = %d\n", INT_MAX);
while (value != 0)
{
printf("value = %d\n", value);
value /= 10;
count++;
}
printf("count = %d\n", count);
return 0;
}