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

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -