In the function,
void read_word(int counts[26])
you declare array counts
again,
int counts[26] = {0};
You need to change the array counts
here to a different name.
By reading your source code, I suggest that you remove the declaration of counts
in the function.