我不能做tab [i] =“返回我的功能”吗?
void creat_tab(int x, int y)
{
int tab[x][y];
int i;
int tmp;
tmp = y * 2;
i = 0;
while (i <= x)
{
if (i == 0 || i == x)
tab[i] = place_full_border(tab[i], x, y); /* here */
else if (i == 1)
tab[i] = place_first_wall(tab[i], x, y); /* here */
else
tab[i] = place_wall(tab[i], tab[i - 1], tmp, y); /* here */
i++;
}
aff_tab(tab);
}
当我编译它时告诉我:
从类型'int *'
答案 0 :(得分:3)
tab [i](只有一个下标)仍然是一个数组,而不是一个元素,所以你不能分配给它(它不是一个左值)。您只能通过遍历元素来分配给数组。