strtok函数

 1 #include<stdio.h> 
 2 #include<string.h>
 3 
 4 int main()
 5 {
 6     char a[100] = "aa_vfb_wffwk_fth_nnn";
 7     char *s;//定义一个char的指针变量 
 8     s = strtok(a, "_");//strtok函数分割字符串 
 9     
10     while(s)
11     {
12        printf("%s
", s); 
13        s = strtok(NULL, "_");//第二次调用,第一个参数写NULL
14     }
15     
16     return 0;
17 }

 

原文地址:https://www.cnblogs.com/yangxiaoqin/p/8370932.html