小编Mik*_*ike的帖子

这个片段中的指针发生了什么?

我很好奇为什么这是一个错误以及错误消息的含义.这是一些代码:

int *x[] = {"foo", "bar", "baz"};
int *y[] = {"foo", "bar", "baz"};

x = y;
Run Code Online (Sandbox Code Playgroud)

我尝试编译,我得到这个:

error: incompatible types when assigning to type ‘char *[3]’ from type ‘char **’
Run Code Online (Sandbox Code Playgroud)

问题#1为什么这是一个错误?和问题#2为什么类型不同?

c pointers

7
推荐指数
1
解决办法
1804
查看次数

标签 统计

c ×1

pointers ×1