でここでは、私のコードです:バスエラー:私はコード、常にバスエラー10を実行しているときに10はstrtokとC
void print_tokens(char *line)
{
static char whitespace[] = " \t\f\r\v\n";
char *token;
for(token = strtok(line, whitespace);
token != NULL;
token = strtok(NULL, whitespace))
printf("Next token is %s\n", token);
}
int main(void)
{
char *line = "test test test";
print_tokens(line);
return 0;
}
私を助けてください!
(http://stackoverflow.com/questions/4480552/why-does-the-following-c-program-give- a-bus-error) – Darthfett
また、上記のコードでは、 'for'行の ';'の前に ')'がありません。 (そしておそらく '{'、 '}') – Toby