tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Strange sizeof construct


From: Fred Weigel
Subject: Re: [Tinycc-devel] Strange sizeof construct
Date: Fri, 23 Nov 2007 08:57:06 -0500

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]