I just got some problems to determine the number of elements in one of my arrays. I got for example following code:
typedef struct
{
char b[100];
int c;
}abc;
typedef struct
{
char qwe[50];
abc *poi;
}def;
abc xyz[] = {
{"xyz", 10},
{"ijk", 20},
{"gdf", 30},
{"hfg", 40}
};
abc uio[] = {
{"cde", 50},
{"ghi", 60},
{"hbc", 70}
};
def mnb[] = {
{"kio", xyz},
{"mkl", uio}
};
I know that I can determin the number of elements in the array mnb
like this:
int count_mnb = sizeof(mnb) / sizeof(mnb[0]);
But how do I determine the number of elements in xyz
? I want to use xyz
as part of the first element of mnb
and not just replace mnb
by xzy
. Something like this:
int count_xyz = sizeof(*mnb[0].poi) / sizeof();
But I couldn't figure how to do this.