R
RedLars
Given this generic object;
typedef struct
{
const char * name;
int address;
} Parameter;
I defined the following array of Parameters;
static Parameter para = {{"BUS", 1},{"Network", 102}, {NULL, 0}};
Would this be the most robust \ safest way of getting the size of the
array ?
void foo(Parameter * parameter)
{
int arraySize = 0;
while (parameter->name != NULL) arraySize++;
}
Thanks
typedef struct
{
const char * name;
int address;
} Parameter;
I defined the following array of Parameters;
static Parameter para = {{"BUS", 1},{"Network", 102}, {NULL, 0}};
Would this be the most robust \ safest way of getting the size of the
array ?
void foo(Parameter * parameter)
{
int arraySize = 0;
while (parameter->name != NULL) arraySize++;
}
Thanks