What is special about structs?

A better way of asking the same question would be “what is special about arrays”, for it is the arrays that have special handling attached to them, not structs.

The behavior of passing and returning arrays by pointer traces back to the original implementation of C. Arrays “decay” to pointers, causing a good deal of confusion, especially among people new to the language. Structs, on the other hand, behave just like built-in types, such as ints, doubles, etc. This includes any arrays embedded in the struct, except for flexible array members, which are not copied.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)