Mail Archives: djgpp/1997/11/25/09:44:10
At 11.16 1997-11-25 +0100, you wrote:
>At 10:42 25.11.97 -0500, you wrote:
>>At 19.33 1997-11-24 -0500, you wrote:
>
>>I think that sizeof(array), would just return the size of a pointer, since
>>that is what it is, and not the size of the actual array.
>
>This is wrong.
>
>ANSI C standard (ISO/IEC 9899:1990 p.45):
>
>[...]
>Another use of the sizeof operator is to compute the number of elements in
an array:
>
> sizeof array / sizeof array[0]
Hmm... Oh well, I was probably wrong about that, but it will only work for
static arrays anyway, not dynamically allocated. And since you always will
know the size of a static array at compile time, it's not all that useful.
- Raw text -