I keep getting a segmentation error and i don't know why. Can you please help?
Here's the program:
/*This program is suppose to take a sentence as input (in a string) and compute the number of words in the sentence.
int i, leng, number_words;
char *sent = sentence;
// while (scanf("%s", sent) == 1)
// printf("%s\n", sent);
leng = strlen(sentence);
for(i=0; i<leng); i++)
if ((sentence[i] == ' ') || (sentence[i] == ','))
number_words = number_words + 1;
printf("the number of words is %d\n", number_words);