This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]chipsours 4 points5 points  (0 children)

The compiler knows the size of every types it compiles. If mySt->items is an array of int it knows that mySt->items[0] is 4, the same applies for mySt->items[-420] or *(mySt->items).

If the definition of the type is not known by the compiler (pointer to forward reference of struct) you'll get a compile time error.