【发布时间】:2015-09-03 13:41:38
【问题描述】:
所以我想弄清楚如何将数组更改为常量,但我一直收到这个错误
warning: incompatible pointer types passing
'char *[3]' to parameter of type 'char *' [-Wincompatible-pointer-types]
strcpy(input, inputcon);
^~~~~`
这是我的代码
int main(void) {
char *input[3];
int yn = 0;
char *no = "no";
char *inputcon = NULL;
do {
printf("This is the game.\nDo you want to play again?\nType y/n: ");
scanf("%s",*input);
strcpy(input, inputcon);
yn = strcmp(inputcon, no);
} while (yn == 1);
}
【问题讨论】:
-
array到constant?? -
您是否阅读过您使用过的函数的手册页?
-
在继续处理字符串之前,您需要阅读有关数组和指针的知识。
标签: c arrays gcc-warning