#include <stdlib.h>
#include <stdio.h>
void splitString(char ** arr,char * source,int & count){
count = 0;
char *s =NULL;
s=strtok(source," ");
printf("s= %s\n",s);
while(s != NULL)
{
*arr++ = s;
count ++;
s = strtok(NULL," ");
}
}
void main(){
char * arra[30];
char str[100] = "i love you";
int count = 0;
splitString(arra,str,count);
for(int i =0;i<count;i++)
printf("%s\n",arra[i]);
printf("\n");
}
C语言 对字符串进行分割
最新推荐文章于 2025-07-20 05:00:00 发布