初级会员

- 积分
- 133
- 金钱
- 133
- 注册时间
- 2018-11-25
- 在线时间
- 17 小时
|
void split( char **arr, char *str, const char *del)//字符分割函数的简单定义和实现
{
char *s =NULL;
s=strtok(str,del);
while(s != NULL)
{
*arr++ = s;
s = strtok(NULL,del);
}
}
一个字符串分割函数,看以上代码,在C语言环境下调试没问题,在Keil uVision5环境下调试,s=strtok(str,del);语句报错误如下:
..\HARDWARE\STMFLASH\stmflash.c(123): error: #513: a value of type "int" cannot be assigned to an entity of type "char *"。s是指针变量,strtok()函数的返回值是指针,为什么出现以上错误请高手指点!
|
|