Why is pointing to one before the first element of an array not allowed in C?

Viewed 633

In C, a pointer is allowed to point to any element of an array, as well as to one past the last element of the array; pointing to beyond this is undefined behavior (C11 standard, §6.5.6, paragraph 8).

However, why is pointing to one before the first element of an array not similarly allowed?

P.S: I know that, in order to circumvent the above restriction, one can sometimes declare an array 1 unit larger than needed, then use only positions from 1 on to store elements, and finally leave position 0 just as a guarantee that traversing the array backwards will be safe. However, sometimes we must use an array as given, and then the problem of pointing to one before the first element remains.

3 Answers
Related