c++ pp page61
c++ pp page76
不能将一个数组直接赋值给另一个数组,如
int cards[4] = {3,4,5,6}; int hands[4]; hands = cards; //not allowed
但是,可以使用赋值运算符(=)将结构体赋值给另一个同类型的结构体,即使成员是数组,如:
struct inflatable { char name[20]; float volumn; double price; }; int main() { inflatable bouquet = { "sunflowers", 0.20, 12.49 }; inflatable choice; choice = bouquet; //allowed, even though there is an array in struct }
一篇解释如下:
https://www.zhihu.com/question/377249567