Problem with array of elements of a structure type

Posted by kobac on Stack Overflow See other posts from Stack Overflow or by kobac
Published on 2010-04-18T12:02:20Z Indexed on 2010/04/18 12:03 UTC
Read the original article Hit count: 276

Filed under:
|

I'm writing an app in Visual Studio C++ and I have problem with assigning values to the elements of the array, which is array of elements of structure type. Compiler is reporting syntax error for the assigning part of the code. Is it possible in anyway to assign elements of array which are of structure type?

typedef struct {
    CString x;
    double y;
} Point;


Point p[3];
p[0] = {"first", 10.0};
p[1] = {"second", 20.0};
p[2] = {"third", 30.0};

© Stack Overflow or respective owner

Related posts about c++

Related posts about arrays