here is the code struct point_tag { int x; int y; }; typedef struct point_tag Point; int main(void) { Point pt[] = { {10,20}, {30, 40}, {50,60}}; pt[0] = {100,200}; }
When I do pt[0] = {100, 200} , the compiler continues to complain about
error: expected expression before '{' token
I really don't get it. Isn't this an expression before the assignment operator {token (=)?
I do not understand why an appointment would be a problem. the value in the pt address refers to the Point array. I just set the 0th item to this new point, and I know that assigning a structure in a format like {100,200} is legal if the elements inside this array are just fields.
source share