Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!sun!guy From: guy@sun.UUCP Newsgroups: net.lang.c Subject: Re: Using strings as immediate character arrays Message-ID: <6309@sun.uucp> Date: Tue, 19-Aug-86 02:25:58 EDT Article-I.D.: sun.6309 Posted: Tue Aug 19 02:25:58 1986 Date-Received: Wed, 20-Aug-86 05:29:12 EDT References: <790@navajo.STANFORD.EDU> Organization: Sun Microsystems, Inc. Lines: 18 > cmdchr = "rofq"[menu_selection] ; > > Is this legal and portable? It seems to work. -tom It is perfectly legal, and therefore portable to all C implementations. There may, however, be programs that purport to be C compilers that don't implement it, although I don't know of any. (The real test, of course, is whether cmdchr = menu_selection["rofq"]; yields the same result. Any compiler that doesn't produce object code that yields the same result isn't a C compiler.) -- Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com (or guy@sun.arpa)