Why declare a struct that only contains an array in C?

It allows you to pass the array to a function by value, or get it returned by value from a function.

Structs can be passed by value, unlike arrays which decay to a pointer in these contexts.

Leave a Comment