Message-Id: <3.0.16.19971125153717.22afa3b6@hem1.passagen.se> Date: Tue, 25 Nov 1997 15:37:31 -0500 To: Anton Helm From: Peter Palotas Subject: Re: pointers &arrays[] Cc: djgpp AT delorie DOT com Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Precedence: bulk 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.