I have a struct and a function, which returns a pointer to the struct it read:
typedef struct cal_t {
float xm;
float ym;
float xn;
float yn;
} cal_t;
struct cal_t *lld_tpReadCalibration(void);
Somewhere else, I do have an instance of that struct:
struct cal_t cal;
Now I need to assign tha values of that instance of the struct to the values of the struct I get the pointer returned of. So what I want is that cal.xm is the same value as cal->xm in inside lld_tpReadCalibration(). Symbolicly:
struct cal_t cal;
cal = lld_tpReadCalibration();
But this dosen't work, of course:
error: incompatible types when assigning to type 'volatile struct cal_t' from type 'struct cal_t *'
How can I make this work the way I want it?
Thanks for your help.