|
![](/i/fill.gif) |
Warp wrote:
> Orchid XP v8 <voi### [at] dev null> wrote:
>>>>> Since sizeof() of an array returns the total amount of bytes taken by
>>>>> an array, if you divide it by the amount of bytes of one element, you get
>>>>> the total number of elements.
>>>> This is plain. What surprises me is that sizeof() can give you an
>>>> accurate size in the first place.
>>> Why wouldn't it? The compiler has to know the size of the array if it
>>> wants to allocate it in memory.
>
>> All that stuff about "C does not know the size of an array at run-time,
>> and does not check array bounds".
>
> That talks about dynamically allocated arrays, not statically allocated
> ones. They are different.
He's right, tho. C doesn't know the size of an array at run time. sizeof()
is a compile-time operator.
--
Darren New, San Diego CA, USA (PST)
Forget "focus follows mouse." When do
I get "focus follows gaze"?
Post a reply to this message
|
![](/i/fill.gif) |