Hello below you will see that I tried to define a struct and then initialize some of its members and the program builds fine with no errors whatsoever however in my IDE (VS 2017) some of things are underlined show errors.I.E. myemt -> declaration has no storage class or type specifier. If anyone could advise me on where I am going wrong with my declaration that would be great! Thanks.
If you don't specify it will use the order that the members are defined in the struct.
1 2 3 4 5 6 7 8 9 10 11
EMT myemt[10][5] =
{
{
12, // pipesize
5.883, // bendRadius
2.973, // shoeDimension
0.530, // conduitDimension
48.000 // tail
},
// and so on
};
In C++20 you will be able to specify which members you want to initialize explicitly, but the order must still be the same as they are defined inside the struct.
1 2 3 4 5 6 7 8 9 10 11
EMT myemt[10][5] =
{
{
.pipesize = 12,
.bendRadius = 5.883,
.shoeDimension = 2.973,
.conduitDimension = 0.530,
.tail = 48.000
},
// and so on
};