Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!ucla-cs!zen!ucbcad!ucbvax!decvax!tektronix!orca!tekecs!doghouse!snoopy From: snoopy@doghouse.gwd.tek.com (Snoopy) Newsgroups: comp.lang.c,misc.jobs.misc Subject: Re: weird c code/ c test Message-ID: <8919@tekecs.TEK.COM> Date: Thu, 30-Jul-87 17:21:44 EDT Article-I.D.: tekecs.8919 Posted: Thu Jul 30 17:21:44 1987 Date-Received: Sat, 1-Aug-87 21:30:18 EDT References: <1089@gilsys.UUCP> Sender: news@tekecs.TEK.COM Reply-To: snoopy@doghouse.gwd.tek.com (Snoopy) Organization: The Daisy Hill Puppy Farm Lines: 33 Keywords: test, employment, weird, code, pointers Xref: mnetor comp.lang.c:3400 misc.jobs.misc:528 In article <1089@gilsys.UUCP> mc68020@gilsys.UUCP (Thomas J Keller) writes: | See if you can determine the output of this program | without actually compiling it: | | #include | | char *c[] = { "ENTER", "NEW", "POINT", "FIRST" }; | char **cp[] = { c+3, c+2, c+1, c }; | char ****cpp = cp; | | main() | { | printf("%s", **++cpp); | printf("%s ", *--*++cpp+3); | printf("%s", *cpp[-2]+3); | printf("%s\n", cpp[-1][-1]+1); | } It works much better if you use char ***cpp = cp; instead of char ****cpp = cp; Snoopy tektronix!doghouse.gwd!snoopy snoopy@doghouse.gwd.tek.com "And it's a middle-endian machine with trinary logic." "They would do that."