can you find the bug of this code

Status
Not open for further replies.

AliBahar

Member level 2
Joined
Feb 4, 2015
Messages
42
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
337
Hi friends,
I have written the below code which is compiled with codevisionAVR:
Code:
typedef struct {
    unsigned char QAddrHi;
	unsigned char QAddrLo;
	unsigned char QcountHi;
	unsigned char QcountLo;
	unsigned char RByteCount;
	unsigned int RNum;
	unsigned char RData[NumDefault];
} IOData;
IOData.QAddressHi=*data;

data is the name of an array and it's type is unsigned char;
but this error appears:illegal symbol.
 

What about that:

Code:
typedef struct {
    unsigned char QAddrHi;
	unsigned char QAddrLo;
	unsigned char QcountHi;
	unsigned char QcountLo;
	unsigned char RByteCount;
	unsigned int RNum;
	unsigned char RData[NumDefault];
} IOData;
IOData MyData;

int main() {
   MyData.QAddressHi = *data;
}

EDIT: Of course it does not work, because QAddressHi does not exists in your structure.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…