[C] 查找由在第二个串中指定的分界符分隔开的单词 →→→→→进入此内容的聊天室

来自 , 2020-04-11, 写在 C, 查看 174 次.
URL http://www.code666.cn/view/db9eeb7e
  1. #include <string.h>
  2. #include <stdio.h>
  3.  
  4. int main(void)
  5. {
  6.    char input[16] = "abc,d";
  7.    char *p;
  8.  
  9.    /* strtok places a NULL terminator
  10.    in front of the token, if found */
  11.    p = strtok(input, ",");
  12.    if (p)   printf("%s\n", p);
  13.  
  14.    /* A second call to strtok using a NULL
  15.    as the first parameter returns a pointer
  16.    to the character following the token  */
  17.    p = strtok(NULL, ",");
  18.    if (p)   printf("%s\n", p);
  19.    return 0;
  20. }
  21.  

回复 "查找由在第二个串中指定的分界符分隔开的单词"

这儿你可以回复上面这条便签

captcha