I am trying to assign values to an array within a typedef struct and continually am getting an syntax error.
Error expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
Here is my code:
myfile.h
#define Digit12 0x00u
#define Digit34 0x01u
#define Digit56 0x01u
typedef struct
{
uint8_t trData[3];
} CImageVersion;
myfile.c
CImageVersion oImageVersion; // declare an instance
oImageVersion.trData = { Digit12, Digit34, Digit56};
Later on in the code
otherfile.c
extern CImageVersion oImageVersion;
An arry is a pointer but if i change the assignment to
oImageVersion->trData = { Digit12, Digit34, Digit56};
I get the same error. I am very confused as to what I am doing wrong The error is pointing to directly after the oImageVersion when I assign the values
CImageVersion oImageVersion; // declare an instance oImageVersion.trData = { Digit12, Digit34, Digit56};-->CImageVersion oImageVersion = { {Digit12, Digit34, Digit56} };->is for pointers to structures. Actual structures use.oImageVersion = (CImageVersion) { {Digit12, Digit34, Digit56} };