#include <string.h>
#include <stdio.h>
int main () {
char str[50] = "lidan,wangyang;zhangwei:shunbin?yifan'xinyue";
char *p[7];
int i = 0;
p[i] = strtok(str,",;?':");
while(p[i] != NULL){
i++;
p[i] = strtok(NULL, ",;?':");
}
for(int j = 0; j < i; j++){
printf("p[%d] = %s\n",j, p[j]);
}
return(0);
}
运行结果:
![](/i/l/?n=23&i=blog/2593183/202307/2593183-20230715124757107-466475481.png)
标签:include,2593183,函数,strtok,int,char,使用,NULL
From: https://www.cnblogs.com/x47083/p/17555977.html