Write a simple function that counts the number of occurances of a char in a string.