【发布时间】:2016-03-26 11:17:40
【问题描述】:
我在 C 代码中使用了 strsep(),但出现了这个错误。
void get_token()
{
char *token;
char *stringp;
int n = 1;
stringp = buf;
while( stringp != NULL )
{
token = strsep(&stringp, "\t\n");
switch(n) {
case 1 : strcpy(label, token);
case 2 : strcpy(opcode, token);
case 3 : strcpy(operand, token);
} n++;
}
}
这是我的代码,我像这样使用 strsep()。 我不知道错误所说的 int。 strsep() return char* 我想。
【问题讨论】:
-
你是不是忘了
#include <string.h>? -
buf 是数组(全局)
-
我已经添加了string.h
-
你的图片描述说这不是一个错误,它只是一个警告
-
发布的代码由于许多不同的原因无法编译。请发布编译的代码,除了指出的问题。