gcc - How is it possible for a C struct to reference itself? -
how c compiler (i'm using gcc) know following?
struct node { int x; struct node* next; }; more precisely, if node has yet defined yet (we have not reached closing curly brace), how compiler know how big struct ought be?
while realize "pointing to" requires address, incrementing pointers require size of data points to.
the size of struct not important, pointer struct being stored, not struct itself.
in terms of incrementing pointers struct; done outside of struct definition, again, not important.
Comments
Post a Comment