首页 > 编程知识 正文

strtok返回值,strtok函数在哪个头文件

时间:2023-05-04 20:12:09 阅读:144933 作者:495

# include string.h # include stdio.hint main (void ) ) charinput(16 )='ABC,d,e '; char*p;/* strtokplacesanullterminatorinfrontofthetoken,if found */p=strtok (输入、'、'; //首先使用字符串input数组标题,剩下的使用NULL /*strtok ) )将字符串分割为一个个片段。 参数s指的是要分割的字符串,参数delim是分割字符串中包含的所有字符。 strtok ) )在参数s的字符串中找到参数delim中包含的分隔符后,将该字符更改为个字符。 在第一次调用中,strtok ()必须提供参数s字符串,而在后续调用中将参数s设置为NULL。 每次调用成功时,返回指向分割片段的指针。 */if(p ) printf('%sn ',p );/* asecondcalltostrtokusinganullasthefirstparameterreturnsapointertothecharacterfollowingthetoken */p=strtok (空,',),p p=strtok (空、'、'; if(p ) printf('%sn ',p ); 返回0; }

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。