Charlie U
Joined: 09 Sep 2003 Posts: 183 Location: Somewhere under water in the Great Lakes
|
|
Posted: Wed Feb 09, 2005 7:28 am |
|
|
With that bit of code, you have only informed the compiler that you want a struct that looks like that with a name "DevCSW". If I am not mistaken, this is the "tag". You can use this tag to declare structures of this type later, such as passing to or returning from a function. You have not as yet actually declared a structure in memory because you have not given it an identifier. You can do this by either adding an identifier following the end brace but prior to the semicolon, or on a separate line after the structure declaration:
Code: |
struct DevCSW
{BYTE Signature[4];
BYTE Tag[4];
BYTE DataResidue[4];
BYTE Status;
} myStruct;
or
struct DevCSW
{BYTE Signature[4];
BYTE Tag[4];
BYTE DataResidue[4];
BYTE Status;
};
struct DevCSW myStruct;
|
To initialize the structure, you must either initialize the members individually or at the time they are defined such as:
Code: |
struct DevCSW
{BYTE Signature[4];
BYTE Tag[4];
BYTE DataResidue[4];
BYTE Status;
} myStruct = {0,0,0,0,0,0,0,0,0,0,0,0,0};
|
Hope this helps. |
|