I need help assigning a value to an array with in a structure. Your help is greatly appreciated:
typedef struct _temp_t {
int16_t _values[4];
} TEMP_T;
void func() {
TEMP_T *temps;
int x = 5;
temps._values[0] = x;
}
I’m getting an error :
...src/rodm/ucdCom.c:512: error: request for member '_values' in something not a structure or union
Your help is greatly appreciated!
tempsis a pointer, so it has no members, onlystructs andunions have members.After you allocated memory for
temps, you could setOr you can declare
tempsas aTEMP_T,and leave the rest of the code as is.