J
Jeff
Given a struct, TEST, I'd like to create a static end of array marker,
also of type test. This way static arrays of type TEST could be easily
created and their end could be marked with the end of array marker.
I think the code below is more clear than the explanation above:
//struct TEST
typedef struct
{
char *desc[2];
UINT mask;
}TEST;
/end of array marker
TEST END{"-1","-1",-1};
TEST t[] = {
{"a","b",1},
{"c","d",2},
END
};
This doesn't compile. 'initializing' : cannot convert from 'TEST' to
'char *'
I thought about using an array of pointers to TEST structs, and then
simply using NULL to mark the end of the array. But the static
initiliazation of such an array would be kind of a pain.
I'd have to initialize an array of TEST structs and then initalize the
array of pointers to struct w/ pointers to each element of the TEST
struct array.
TEST t[] = {
{"a","b",1},
{"c","d",2}
}
TEST *a[] = {&t[0],&t[1]};
Any ideas?
Thanks,
Jeff
also of type test. This way static arrays of type TEST could be easily
created and their end could be marked with the end of array marker.
I think the code below is more clear than the explanation above:
//struct TEST
typedef struct
{
char *desc[2];
UINT mask;
}TEST;
/end of array marker
TEST END{"-1","-1",-1};
TEST t[] = {
{"a","b",1},
{"c","d",2},
END
};
This doesn't compile. 'initializing' : cannot convert from 'TEST' to
'char *'
I thought about using an array of pointers to TEST structs, and then
simply using NULL to mark the end of the array. But the static
initiliazation of such an array would be kind of a pain.
I'd have to initialize an array of TEST structs and then initalize the
array of pointers to struct w/ pointers to each element of the TEST
struct array.
TEST t[] = {
{"a","b",1},
{"c","d",2}
}
TEST *a[] = {&t[0],&t[1]};
Any ideas?
Thanks,
Jeff