69,373
社区成员
发帖
与我相关
我的任务
分享
#include <string.h>
#include <stdio.h>
int main (void)
{
char s[120]= "ok/hello:hello,let you Go ahead";
char* ch = s;
printf("%s\n",ch);
char *pt;
pt = strsep(&ch,":");
printf("%s\n",pt);
return 0;
}
char *ch;
char s[120]= "ok/hello:hello,let you Go ahead"
ch = (char*) malloc(120);
strcpy(ch,s);
printf("%s\n",ch);
char *pt;
pt = (char*) malloc(120);
memset(pt,0,120);
pt = strsep(&ch,":");
printf("%s\n",pt);
return 0;