我想在字符串数组中添加一个字符串,但它不起作用 目前,我有那段代码:
void splitArray(char *strings, char *delimiter) {
int i = 0;
char newArray[MAXCHARS];
char* pch = NULL;
pch = strtok(strings, delimiter);
while (pch != NULL)
{
// doesn't work; Exception: warning: assignment makes integer from pointer without a cast [enabled by default]
newArray = pch;
printf("%s\n", pch);
pch = strtok(NULL, delimiter);
}
}
我该如何解决这个问题?
答案 0 :(得分:3)
使用strcpy将字符串复制到char数组。