Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!uflorida!haven!ncifcrf!nlm-mcs!adm!smoke!gwyn From: gwyn@smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: Declaration puzzler (another old question?) Message-ID: <8633@smoke.ARPA> Date: 5 Oct 88 05:15:40 GMT References: <30091@oliveb.olivetti.com> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 21 In article <30091@oliveb.olivetti.com> chase@orc.olivetti.com (David Chase) writes: >I can't figure out how to declare the type of an array with (say) 10 >elements, each of which is that array type. You can't. A C type cannot contain itself (although it CAN contain pointers to instances of itself, under some circumstances). >This is all a little puzzling to me. If I didn't know that C was >wonderful, I might think that arrays were a second-class type. Arrays ARE second-class citizens in C. This is quite well known. However, the problem is that you're trying to do two things in one declaration. Use two declarations, the first for an incomplete type and the second using that incomplete type to help define a complete type of the desired shape. You will have to resign yourself to using structures for this, since a type has to be ultimately expressable in terms of basic types, bit fields, etc. or pointers to structures. Are you sure you really need a type like that?