AliBahar
Member level 2
Hi every one. I have typical structure (ECU_t) which has members that considered to be pointer to struct.
i make my question in c code comments. please help me. by the way i have used freescale code warrior as compiler.
i make my question in c code comments. please help me. by the way i have used freescale code warrior as compiler.
Code:
typedef enum
{
NORMAL,
WARNING,
}WATER_TEMP;
typedef struct
{
WATER_TEMP water_temp;
uint16_t speed;
// ... other members
}Engine_t;
typedef struct
{
Engine_t* engine;
ABS_t* abs;
// ... other members
}ECU_t;
void ECU_DoTask(ECU_t* output)
{
output->engine->water_temp = NORMAL;
}
void main ()
{
ECU_t ecu;
ECU_DoTask(&ecu);
// i want to access to water_temp. how can i do it?
// if i use (ecu.engine->water_temp) there is no value (NORMAL) in variable.
while(1);
}