As [answered elsewhere](https://stackoverflow.com/q/5243012/417501), calling functions like `memcpy` with invalid or `NULL` pointers is undefined behaviour, even if the length argument is zero. In the context of such a function, especially `memcpy` and `memmove`, is a pointer just past the end of the array a valid pointer?

I'm asking this question because a pointer just past the end of an array is legal to obtain (as opposed to, e.g. a pointer two elements past the end of an array) but you are not allowed to dereference it, yet footnote 106 of ISO 9899:2011 indicates that such a pointer points to into the address space of the program, a criterion required for a pointer to be valid according to §7.1.4.

Such usage occurs in code where I want to insert an item into the middle of an array, requiring me to move all items after the insertion point:

```
void make_space(type *array, size_t old_length, size_t index)
{
    memmove(array + index + 1, array + index, (old_length - index) * sizeof *array);
}

```

If we want to insert at the end of the array, `index` is equal to `length` and `array + index + 1` points just past the end of the array, but the number of copied elements is zero.