Yes, you can pass a struct by value, but it is rarely done.
Presumably arrays cannot be passed by value for two reasons:
- Arrays can be huge, and since passing by value means
making a copy of it, it would be very inefficient.
- The compiler does not know the size of a dynamic array.
Actually, you can put a (non-dynamic) array into a struct
and pass it by value that way!