I am writing a program in C and I want to count how the number of words in the string by dividing the string by the spaces.
Here is some of my code
while((temp = strsep(&tempInput, " "))!=NULL)
{
tempArguments[number] = temp;
number++;
printf("AGAIN\n");
}
printf("number: %d",number);
For some reason I get a segmentation fault when the loop terminates. Does anybody have an idea as to what could be causing this?