An array is represent using a struct with a pointer to the array data and the length, like this:

struct Array
{
    void* ptr;
    size_t length;
}

The struct is passed by value, but since it contains a pointer to the data it will be passed by reference. Note that if you do:

void foo (int[] a)
{
    a ~= 3;
}

auto b = [3, 4];
foo(b);

The caller will not see the change made by "foo".

Don't know if this explanation helped you to understand.

What does a fixed length array look like when passed, doesn't it have a similar payload of data and length? I take it you mean the struct method is the variable length array.

Reply via email to