The ampersand is an access symbol. Count represents the address of the count, so the definition of the CountStars function should be in the following format:
void CountStars(char **stars,w,int *count)
So the implementation in your function is also wrong. I suggest you learn the contents of the chapter "Pointer and Array" in C language first, and then do this problem after learning.