What is the proper syntax for initializing a pointer to an array of structures?
I have the following definitions:
If I try to initialize the pointer ptrTL it works fineCode:typedef struct { int Targets; Target_t targets[TARGETS_MAX]; } TargetList_t; typedef struct { int id; float distX; float distY; }Target_t; TargetList_t foo[SENS_MAX]; TargetList_t* ptrfoo = &foo; TargetList_t TL; TargetList_t* ptrTL = &TL;
However, in initializing the pointer to fooCode:ptrTL->targets[0].distX = 4;
I get an error saying:Code:ptrfoo[0]->targets[0].distX = 2;
what gives? How can I initialize a pointer to an array of structures?error C2232: '->targets' : left operand has 'struct' type, use '.'



LinkBack URL
About LinkBacks



