Question: I am trying to learn how to write recursive functions in C and I wrote this function that counts the number of zeros in a specified positive number, as a practice. But, it can only handle input with a maximum length of 10. Input with 11 or more numbers fails and I can't see why.

Ex. 

```
input = 1204067809 (correct)
output = 3

input = 12040678091 (fails!!)
output = 0

input = 12040678091423401231 (fails!!)
output = 1

```

Code:

```
#include <stdio.h>
int rCountZeros1(int num); 

int main()
{
  int number;
  printf("Enter the number: \n");
  scanf("%d", &number);
  printf("rCountZeros(): %d\n", rCountZeros(number));
  return 0;
}

int rCountZeros(int num) 
{  
  if (num==0)
    return 1;
  else if (num<10)
    return 0;

  if (num % 10 == 0)
    return 1+rCountZeros(num/10);
  else
    return rCountZeros(num/10);
}

```

Answer: 
`12040678091` is > `2**31`, your integers are probably 32-bit, and `scanf` doesn't handle the overflow properly. So it just doesn't work with `int`.

The examples you used would fit in a `unsigned long long` or `uint64_t`. However, I suggest the string approach: don't convert to integers, just do a char by char parsing to count the zeroes, and you'll be able to handle any integer size (well, if your string buffer is big enough, that is)

(counting the chars in a string with a recursive function is now officially overkill, but can be done for research purposes, by propagating the index of the string, not the divided value)
I assume your compiler declares, `int` as 4 byte variable.
Your number should be between the range:

```
signed  : -2,147,483,648 to 2,147,483,647
unsigned: 0 to 4,294,967,295

```

If you want to perform the operation try using a `long long` integer.