C inconsistency?

Farrell Woods ftw at masscomp.UUCP
Mon Apr 3 23:49:13 AEST 1989


In article <1989Mar30.192903.28426 at gpu.utcs.toronto.edu> sarathy at 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 at masscomp.com
1 Technology Way				uucp:   {backbones}!masscomp!ftw
Westford, MA 01886				OS/2:   Half an operating system



More information about the Comp.lang.c mailing list