Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!homxb!houxm!mhuxt!mhuxm!mhuxo!ulysses!sfmag!sfsup!grk From: grk@sfsup.UUCP Newsgroups: comp.lang.c Subject: Re: type-indexed arrays (was: enum - enum ?) Message-ID: <1515@sfsup.UUCP> Date: Mon, 15-Jun-87 11:31:18 EDT Article-I.D.: sfsup.1515 Posted: Mon Jun 15 11:31:18 1987 Date-Received: Wed, 17-Jun-87 02:26:43 EDT References: <139@starfire.UUCP> <516@haddock.UUCP> <20540@sun.uucp> <1226@crash.CTS.COM> Organization: AT&T-IS, Summit N.J. USA Lines: 18 [Original article not included for brevity--type `p' if you want to see it] There have been several people who suggested that it would be nice if C had non-zero origined arrays. How about the following (albeit kludgy) solution: int a[21]; /* really meant to be a[ -10 .. 10 ] */ int *na; /* na stands for new-a, good software engineering type descriptive variable name :-) */ na = &a[10]; /* na[-10] is now a[0], na[0] is a[10], etc. */ --Ralph -- G. Ralph Kuntz N2HBN UUCP: {ihnp4,allegra}!attunix!grk ARPA: rutgers.rutgers.edu!pisc2b!grk PACKET: N2HBN @ NN2Z