I want to access a member of struct from some header data. Here is an example from my code:
char wk1[2];
union
{
unsigned short WORD;
struct
{
unsigned short SSBY:1;
unsigned short OPE:1;
} BIT;
} SBYCR;
char wk3[5];
union {
unsigned char BYTE;
struct {
unsigned char :7;
unsigned char BCLKDIV:1;
} BIT;
} BCKCR;
I want to set the bit SSBY to 0
in my main. and tried to access it directly in my main:
void main()
{
SBYCR.BIT.SSBY=0;
}
but it gives me an error E0520020:Identifier "SBYCR" is undefined. I tried to define it again like:
union SBYCR BIT; //but it has an error E0520070:Incomplete type is not allowed
SBYCR.BIT.SSBY=0; // and this, it doesn't recognise the BIT i want, while i have so many variable called BIT.
你想要这个吗?
SBYCR.BIT.SSBY=0;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.