A
asm_fool
In the following code:
struct node
{
char p[20];
struct node *next;
};
main()
{
struct node p;
printf("%d \n",sizeof p.next->p);
}
I am getting the output as 20, which is correct. Ok, taking the
account of segment and offset of struct the size of the above struct
is 20 + 4 = 24. Assuming the struct memory address starts from 2000
and adding a 20+4 values we get as:
Seg : off (of whole struct)
2000:2000
2000:2001
2000:2002
….
….
….
2000:2014 (in hex)
seg : off (*next's value)
2004:2015
2004:2016
2004:2017
2004:2018
Is the above form of struct addressing is correct? Will the address of
segff of the next object starts from new address? If yes, then don't
we have another set of segff of
Struct->next->next's value like a mirror in front of a mirror?
struct node
{
char p[20];
struct node *next;
};
main()
{
struct node p;
printf("%d \n",sizeof p.next->p);
}
I am getting the output as 20, which is correct. Ok, taking the
account of segment and offset of struct the size of the above struct
is 20 + 4 = 24. Assuming the struct memory address starts from 2000
and adding a 20+4 values we get as:
Seg : off (of whole struct)
2000:2000
2000:2001
2000:2002
….
….
….
2000:2014 (in hex)
seg : off (*next's value)
2004:2015
2004:2016
2004:2017
2004:2018
Is the above form of struct addressing is correct? Will the address of
segff of the next object starts from new address? If yes, then don't
we have another set of segff of
Struct->next->next's value like a mirror in front of a mirror?