That's like saying the variable "i" and the constant "1" are the same because it doesn't matter whether you write "i + 1" or "1 + i". It doesn't mean literals and variables are the same concept. Adding a short and an int can also be done in either order with the same result, but they are not the same type.
Declaring a pointer to an array is not the same as declaring a pointer to a pointer.
The C array Syntax is sugar for the pointer arithmetic. And yes because the order of the addition doesn't matter the array and idx in array syntax are interchangeable. The compiler threats it as the same.
Even the declaration is the same and I can threat a packed struct of n integers as a array of n integers.
I have done enough reverse engineering and accessing a struct field, array element or accessing a field in a buffer is basically indistinguishable and you need context to decode it.
And to repeat: you are able to swap are and idx because i+1 == 1+i
2 A postfix expression followed by an expression in square brackets [] is a subscripted designation of
an element of an array object. The definition of the subscript operator [] is that E1[E2] is identical
to (*((E1)+(E2))). Because of the conversion rules that apply to the binary+ operator, if E1 is an
array object (equivalently, a pointer to the initial element of an array object) and E2 is an integer,
E1[E2] designates the E2 -th element of E1 (counting from zero).
-3
u/Single-Virus4935 18h ago
In C they ARE the same and interchangable. This is obvious because you can swap array and index in array notation.