gpt4 book ai didi

C: STRTOK 异常

转载 作者:太空狗 更新时间:2023-10-29 17:25:07 25 4
gpt4 key购买 nike

<分区>

出于某种原因,我在第一次使用 strtok() 时遇到异常我想要完成的是一个简单地检查子字符串是否在字符串中重复的函数。但到目前为止我还没有让 strtok 工作

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;
}

和主要调用函数:

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

screenshot of the error im getting

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com