我有以下代码:
int main(){
char sentence[] = "my name is john";
int i=0;
char ch[50];
for (char* word = strtok(sentence," "); word != NULL; word = strtok(NULL, " "))
{
// put word into array
// *ch=word;
ch[i]=word;
printf("%s \n",ch[i]);
i++;
//Above commeted part does not work, how to put word into character array ch
}
return 0;
}
我收到错误:错误:invalid conversion from ‘char*’ to ‘char’ [-fpermissive]
我想将每个单词存储到数组中,有人可以帮忙吗?