#include <string.h> main(){ char s[] = "ab-cd : ef;gh :i-jkl;mnop;qrs-tu: vwx-y;z"; char *delim = "-: "; char *p; printf("%s ", strtok(s, delim)); while((p = strtok(NULL, delim))) printf("%s ", p); printf("\n"); } 执行结果: ab cd ef;gh i jkl;mnop;qrs tu vwx y;z //-与:字符已经被\0 字符取代
微信扫码关注
更新实时通知