Do pointers support “array style indexing”?

You should indeed be using ptr[i] over *(ptr + i) for readability reasons. But apart from that, the [] operator is, strictly speaking, actually never used with an array operand. Arrays, when used in an expression, always “decay” into a pointer to the first element (with some exceptions). C17 6.3.2.1/3, emphasis mine: Except when it … Read more

Accessing arrays by index[array] in C and C++

Yes. 6.5.2.1 paragraph 1 (C99 standard) describes the arguments to the [] operator: One of the expressions shall have type “pointer to object type“, the other expression shall have integer type, and the result has type “type“. 6.5.2.1 paragraph 2 (emphasis added): A postfix expression followed by an expression in square brackets [] is a … Read more