下面这种结构体初始化数组赋值是没有问题的
#include<iostream> using namespace std; struct Param { float a[5]; int nA; }; int main() { struct Param param = { { 2.12, 3.14 }, //a[5] 2, //nA }; for (int i = 0; i < (param.nA); i++) { cout << (param.a[i]) << endl; } return 0; }