Yes, [] can be applied to any pointer. But, it is an operator, like "+".

So, a[i], is an operation involving a and i. In fact, it IS the operation
+. a[i] is *(a + i)

Now *(a + i) is the same as *(i + a). And thus, a[i] is the same as i[a].
Now, a is the same as a pointer, so we can write i[p]. And, we know that the
constant 0 is a pointer, so we can have i[0].

Which means that (eg.) 5[0] and 0[5] may be valid constructs (but, they have
"void" type, so the de-reference should fail!).

Hope that helps,
Fred.


_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to