linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: array size 1 ?  All headers
@ 2004-07-21  2:27 Gre Taguran
  2004-07-21  2:57 ` Luiz Fernando N. Capitulino
  0 siblings, 1 reply; 8+ messages in thread
From: Gre Taguran @ 2004-07-21  2:27 UTC (permalink / raw)
  To: linux-c-programming

i think its not array of 1 but instead array of 2 which is 0 and 1 index. maybe 
it is because u were thinking that the last array index (in this case is 1) is 
null, but it is only applicable when handling string because string needs a 
terminated string. ex.

char tst[1];
tst[0]='g';
tst[1]='r';
printf("%s",tst); //this would print gr<and more chars here because it is not 
terminated
printf("%c=%c"); //this will print gr meaning tst[1] is alocated by 'r'

try this out.

>Hi, 
>What does an array of size 1 mean? or maybe I might be putting it wrong, so 
>here's the declaration - 
>
>struct option_state { 
>   int refcnt; 
>   int universe_count; 
>   int site_universe; 
>   int site_code_min; 
>   VOIDPTR universes[1]; 
>}; 
>
>(code from ISC DHCP sources includes/dhcpd.h) 
>
>What does universes[1] mean here? 
>
>Thanks. 
>-Anshu


GRETAGS
http://www.sni.ph/~gtaguran
Research & Software Development
SNI Phils. CDO 
Tel no. 8585773/720011

--
Message sent using e-Finity WebMail 2.0
System Net International, Philippines, Inc.
an affiliate of SNI, Virginia, USA
www.sni.ph www.sni-inc.com


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-07-21 12:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-21  2:27 array size 1 ? All headers Gre Taguran
2004-07-21  2:57 ` Luiz Fernando N. Capitulino
2004-07-21  3:17   ` joy
2004-07-21 12:10     ` Luiz Fernando N. Capitulino
2004-07-21  3:18   ` Eric Bambach
2004-07-21  3:19   ` canbaby
2004-07-21  3:38   ` Glynn Clements
     [not found]   ` <200407202217.43875.eric@cisu.net>
2004-07-21 12:07     ` Luiz Fernando N. Capitulino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).