westcity wrote:
My code is as following:
struct Point {
float x, y, z ;
};
int main ()
{
Point[3] pts = [
{1.0, 0.0, 0.0} ,
{0.0, 1.0, 0.0} ,
{0.0, 0.0, 1.0}
];
return 0 ;
}
But, the compiler report "Error: array initializers as expressions are not
allowed".
That message's pretty messed up: array initializers look like [1.0, 0.0,
0.0] in D.
Then, how do I initialize an array of struct ?
Replacing the middle lines with these works:
Point(1.0, 0.0, 0.0) ,
Point(0.0, 1.0, 0.0) ,
Point(0.0, 0.0, 1.0)