Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!gatech!hubcap!ncrcae!ncrlnk!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.lang.c Subject: Re: Point me in the right direction Message-ID: <1043@auspex.UUCP> Date: 18 Feb 89 09:50:53 GMT References: <23631@watmath.waterloo.edu> <1841@mit-caf.MIT.EDU> <807@atanasoff.cs.iastate.edu> Reply-To: guy@auspex.UUCP (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 28 >>double fund_consts[] = { >> 3.14159265, >> 2.7182818, >> 6.02E23, >>}; > > Of course, adding: > > #define N_FCONSTS (sizeof(fund_consts)/sizeof(double)) So far, so good - this is an old C trick, which is quite useful, but may not be known as well as it should be - but... > then you can use stuff like: > > extern fund_consts[N_FCONSTS]; (try "extern double fund_consts[...]"; that declaration makes it an array of "int") > elsewhere. ...only if "fund_consts" is *defined* in the same "elsewhere", or at least declared with a size other than N_FCONSTS (since the value of the expression "(sizeof(fund_consts)/sizeof(double))" depends on the size declared for "fund_consts"), which seems unlikely - if it's defined there, why declare it all over again later in the same module?