when you're indexing a pointer using the p[n] notation, it behaves as if you're using pointer arithmetic *(p + n).
Pointer arithmetic is not really defined for std::size_t parameters, it is defined semantically for any "integral type" (5.7[expr.add]p4), and for the purpose of overload resolution, for std::ptrdiff_t parameters: it is T* operator+(T*, std::ptrdiff_t) (13.6[over.built]p13)
size_t is the size of the array (the result of sizeof).
ptrdiff_t is the distance between two elements of an array (the result of subtracting two pointers)
if your array is bigger than PTRDIFF_MAX, certain things (such as subtracting two pointers) cause undefined behavior