5条回答 默认 最新
- _GX_ 2022-02-07 19:19关注
因为
b
的类型是int(*)[2]
,b[i]
的类型是int [2]
,是一个数组类型,C/C++不允许对一个数组类型直接赋值。
把b[i] = a[i]
改为b=a
,这里是指针赋值FROM https://en.cppreference.com/w/cpp/language/array#Assignment
Objects of array type cannot be modified as a whole: even though they are lvalues (e.g. an address of array can be taken), they cannot appear on the left hand side of an assignment operator:
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用 1