Anonymous temporary structures are not a feature of standard C (at least pre-C99), so the assignment doesn't work. Some compilers support anonymous temporary structures, but I'd not depend on it.
I'd recommend coding the thing as something like:
Code:
typedef struct{
double x;
double y;
double z;
} Point;
void setPoint(Point *p, double x, double y, double z)
{
p->x = x;
p->y = y;
p->z = z;
}
and in your loop, do something like:
Code:
for(i=0;i<foobar;i++)
{
setPoint(&setA[i], pt1, pt2, pt3);
}
Assuming that your compiler can return structures, you could also write a helper fuction:
Code:
Point point(double x, double y, double z)
{
Point p = {x, y, z}; // initialization, not assignment
return p;
}
and in your loop do
Code:
setA[i] = point(pt1, pt2, pt3);
This requires structure return, which IIRC is a required feature in C90.
I hope this helps.