Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ulowell!masscomp!ftw From: ftw@masscomp.UUCP (Farrell Woods) Newsgroups: comp.lang.c Subject: Re: C inconsistency? Message-ID: <14@masscomp.UUCP> Date: 3 Apr 89 13:49:13 GMT References: <1989Mar30.192903.28426@gpu.utcs.toronto.edu> Reply-To: ftw@quasar.UUCP (Farrell Woods) Organization: MASSCOMP - Westford, Ma Lines: 30 Approved: news In article <1989Mar30.192903.28426@gpu.utcs.toronto.edu> sarathy@gpu.utcs.UUCP (Rajiv Sarathy) writes: >Is this an inconsistency ?: > struct element { > char *key; > int level; > struct element **fpointer; > } > struct element *head[LEVELCAP]; /* array of pointers to struct */ >Microsoft C 5.1 in MS-DOS compiles this alright, but neither cc nor gcc are >able to compile in UNIX 4.1 (or is it 4.2, I can't remember). Indeed, you're missing a semi-colon. There are two ways you could declare your array of pointers. The first is to correct your declaration by inserting a semi-colon after the closing brace in your structure template. Another is to leave out the semi-colon, as you've done, and also remove the ``struct element'' on the last line. To wit: struct element { char *key; int level; struct element **fpointer; } *head[LEVELCAP]; /* array of pointers to struct */ -- Farrell T. Woods Voice: (508) 392-2471 Concurrent Computer Corporation Domain: ftw@masscomp.com 1 Technology Way uucp: {backbones}!masscomp!ftw Westford, MA 01886 OS/2: Half an operating system