defining struct as global variable

Dear friends,

I am new with the dynamic c… this is my code…
//---------------------------------------------------------------------//
typedef struct THERMOSTATS_INFO {
WORD BlockNumber;
BYTE Branch;
BYTE Address;
BYTE Setpoint_Celcius;
BYTE Setpoint_Fahrenheit;
BYTE FanSpeedAndModes;
BYTE Callibration;
BYTE KeyCard;
BYTE Function;
BYTE Minute;
BYTE Hour;
BYTE CRC;
}ETOP_Thermostats;

static ETOP_Thermostats TemporaryResult;

void setData(void);

main(){

setData();

}

void setData(){
/* this line –> */ TemporaryResult->BlockNumber = 0;
}
//---------------------------------------------------------------------//

when i compile it is no error if i am remove any setData relation. but if i pres F9 or run it say runtimeerror…

is it wrong?

what i supposed to do?

Best Regards,
Hari

TemporaryResult is a structure, not a pointer. Try:

TemporaryResult.BlockNumber = 0;

Seems like the compiler should have complained about this…

it’s work!!

thank you sgt :smiley: