L
lallous
I have the following:
struct struc1
{
int a;
int b;
int c;
};
#define DistanceInStruct(member, struc) (unsigned long)((unsigned
long)(&struc.member) - (unsigned long)(&struc))
I can to this:
int main()
{
struc1 A;
int pos = DistanceInStruct(b, A); // returns 1 * sizeof(int)
pos = DistanceInStruct(c, A); // returns 2 * sizeof(int)
}
how can i accomplish the same but w/o having to declare a local
variable "A" of type 'struc1' ?
Regards,
Elias
struct struc1
{
int a;
int b;
int c;
};
#define DistanceInStruct(member, struc) (unsigned long)((unsigned
long)(&struc.member) - (unsigned long)(&struc))
I can to this:
int main()
{
struc1 A;
int pos = DistanceInStruct(b, A); // returns 1 * sizeof(int)
pos = DistanceInStruct(c, A); // returns 2 * sizeof(int)
}
how can i accomplish the same but w/o having to declare a local
variable "A" of type 'struc1' ?
Regards,
Elias