delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/25/09:44:10

Message-Id: <3.0.16.19971125153717.22afa3b6@hem1.passagen.se>
Date: Tue, 25 Nov 1997 15:37:31 -0500
To: Anton Helm <tony AT nt DOT tuwien DOT ac DOT at>
From: Peter Palotas <blizzar AT hem1 DOT passagen DOT se>
Subject: Re: pointers &arrays[]
Cc: djgpp AT delorie DOT com
Mime-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019