结构和数组('Array'的初始化程序太多)C++

tes*_*ram 2 c++ arrays structure c++11

为什么我会收到错误:'Array'的初始化程序太多它的C++ 11代码我不知道问题出在哪里

#include <iostream>
using namespace std;

struct Point {
int x,y ;
};
Point points[3] {{1,2},{3,4},{5,6}};
int x2 = points[2].x;

struct Array {
Point elem[3];
};

int main() {
    cout << "!!!\nStructure!!!" << endl; //

    Array points2  {{1,2},{3,4},{5,6}};// *too many initializers for‘Array’* 
    int y2 = points2.elem[2].y;

    cout << "!!!here points2 = !!!" << y2 <<endl;

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

Cor*_*mer 8

你实际上还需要一组大括号来初始化它 struct

Array points2  {{{1,2},{3,4},{5,6}}};
//               ^Point
//              ^Point[]
//             ^Array
Run Code Online (Sandbox Code Playgroud)

工作实例