C program to count number of words in a string using pointers