struct A
{
struct one
{
int c;
} details[MAX];
};
struct B
{
struct two
{
int a;
A::one b
} details[MAX];
};
There is a validate function used like below to validate details array of struct in struct A:
bool ValidateOne(struct one * ptr)
{
struct one * tmp[MAX];
for (int i = 0; i < MAX; ++i)
tmp[i] = ptr+i;
Validate(tmp[0]);
}
then there is validations needs to be done on details array of struct B: I expect to do:
bool ValidateTwo(struct two * ptr)
{
struct one * tmp[MAX];
for (int i = 0; i < MAX; ++i)
tmp[i] = &((ptr+i)->b);
Validate(tmp[0]);
//validate other stuff
};
Validate(struct one * ptrs[])
{
int count;
for (int i = 0; i < MAX; ++i)
count += ptrs[i]->a;
}
Would above code work?