, , , . , . ++. , , , extern.
extern coords MyCoords[];
.cpp, , () - , , , :
coords MyCoords[] = {{1, 2}, {3, 4}, ... };
, , , std::vector:
std::vector< coords > MyCoords;
, ,
MyCoords.push_back( coords(1, 2) );
MyCoords.push_back( coords(3, 4) );
....
, , :
coords c[] = ....;
MyCoords.insert(MyCoords.end(), c, c + sizeof c / sizeof *c);
, C ++. , . , , "" . (, , , , , , ), , , 1. ++ , , , , ++.
, ,
MyCoords[0] = {0, 0}
:
-> Set LHS to RHS
-> -> LHS is a variable of type `coords`. Fine
-> -> RHS is... hmm, `{0, 0}`. What the heck is it??
, , . C99, ( 1999 .) .
MyCoords[0] = (coords){0, 0};
, , - coord . , ( C C99-, ++, C89 ), , .