Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!batcomputer!itsgw!steinmetz!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.lang.c Subject: Re: avoiding explicit array sizes (was: Point me in the right direction) Message-ID: <1064@auspex.UUCP> Date: 24 Feb 89 20:44:06 GMT References: <23631@watmath.waterloo.edu> <1841@mit-caf.MIT.EDU> <807@atanasoff.cs.iastate.edu> <14647@ccicpg.UUCP> <415@chem.ucsd.EDU> Reply-To: guy@auspex.UUCP (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 14 > int a[] = { 42, 666, ... }; You forgot 23 :-) > /* compiler will complain if sizeof(a)/sizeof(a[0]) is not equal > * to NELT, thus ensuring that extern.c and header.h are in sync > */ No, it won't necessarily. It'll complain if the list of initializers contains *more* than NELT elements; however, if it contains *fewer* elements, it'll just silently initialize the rest to 0. If this is acceptable, fine, but if you want to make sure you initialize it with *exactly* NELT elements, you need more help than the compiler will give you....