[Top][All Lists]
[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: |
Thu, 22 Nov 2007 01:16:54 -0500 |
Marc
sizeof is an operator
arr evaluates to the base of the array. [] is an operator.
since arr is the base of the array, (arr) is the same value (putting
in the parentheses doesn't change a thing). The precedence is identical!
so, if "sizeof arr[0]" works, then "sizeof (arr) [0]" should be identical.
Since [] is higher precedence, "sizeof(arr[0])" is ALSO the same. And,
just for grins, try:
sizeof((arr)[0])
Of course, this is because [] is an operator in C, and not part of a
variable construct. This means that any [] can be applied to any pointer.