B
Ben C
Arrays don't have copy or assignment semantics, structures do. To
return something by value, you have to copy it. So it does make sense
to be able to return a structure and not an array.
Yes, exactly, the two things go hand-in-hand.
I had a look on Google and found that this has been discussed here
before. Structure assignment, and the possibility of passing and
returning struct instances was a "recent extension" in 1978. In K&R C
you had to memcpy your instances, or do memberwise assignment.
http://tinyurl.com/p635q
But you can assign to one, so it is consistent to be able to return one.
That part's consistent, but structure returning _does_ give rise to an
inconsistency: a struct instance returned from a function is by
(standard) definition an rvalue, even though it's an object. Some
compilers let you assign to it anyway. And it is I think the only way to
contrive an rvalue that's "the result of the [] operator", in the
example we just saw from the previous poster.