C: STRTOK exception

Viewed 2020

for some reason i get an exception at the first use of strtok() what i am trying to accomplish is a function that simply checks if a substring repeats itself inside a string. but so far i havent gotten strtok to work

int CheckDoubleInput(char* input){
char* word = NULL;
char cutBy[] = ",_";

word = strtok(input, cutBy);  <--- **error line**

/* walk through other tokens */
while (word != NULL)
{
    printf(" %s\n", word);
    word = strtok(NULL, cutBy);
}
return 1;
}

and the main calling the function:

CheckDoubleInput("asdlakm,_asdasd,_sdasd,asdas_sas");

screenshot of the error im getting

3 Answers
Related