How to make an array of structs? c++
ok, so...
HBITMAP myStruct[x][y]; //for bitmaps
int myStruct[x][y]; //for numbers
but how do i make an array of structures?
thanks in advance
struct _mystruct
{
int field1;
int field2;
} myStruct[x][y];
========
OR
========
typedef struct _mystruct
{
int field1;
int field2;
} MYSTRUCT;
MYSTRUCT myStruct[x][y];
You reference the fields like this:
myStruct[0][0].field1
myStruct[0][0].field2
[edited by - Dave Hunt on February 7, 2003 2:03:58 PM]
{
int field1;
int field2;
} myStruct[x][y];
========
OR
========
typedef struct _mystruct
{
int field1;
int field2;
} MYSTRUCT;
MYSTRUCT myStruct[x][y];
You reference the fields like this:
myStruct[0][0].field1
myStruct[0][0].field2
[edited by - Dave Hunt on February 7, 2003 2:03:58 PM]
quote:Original post by cgoat
You don''t need to typedef in C++.
struct MyStruct
{
int x, y;
};
MyStruct structArray[32];
True, but it doesn''t hurt.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement