Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: Question on enumeration behavior Message-ID: <7083@brl-smoke.ARPA> Date: 14 Jan 88 10:26:38 GMT References: <2195@vice.TEK.COM> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Distribution: na Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 9 Keywords: enum In article <2195@vice.TEK.COM> dougg@vice.TEK.COM (Doug Grant) writes: >I have observed that when I define an enumeration type, the first >enumeration constant receives the integer value 0, the next 1, etc. >Is this behavior guaranteed by the ANSI standard? Yes, and you can force any value to be used for the start of a sequence of enumeration values by specifying it, as in: enum { red = 4, blue, green, yellow = 1 } color; which gives blue and green the values 5 and 6 respectively.