Path: utzoo!attcan!uunet!convex!texsun!pitstop!sun!decwrl!ucbvax!tut.cis.ohio-state.edu!ukma!husc6!think!barmar From: barmar@think.COM (Barry Margolin) Newsgroups: comp.lang.c Subject: Re: An interesting behaviour in printf Message-ID: <37653@think.UUCP> Date: 20 Mar 89 00:23:10 GMT References: <960@Portia.Stanford.EDU> <15938@cup.portal.com> <2343@buengc.BU.EDU> Sender: news@think.UUCP Reply-To: barmar@kulla.think.com.UUCP (Barry Margolin) Distribution: na Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 18 In article <2343@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes: >>In <960@Portia.Stanford.EDU>, joe@hanauma (Joe Dellinger) asks: >>> string[0] = '*'; >>> string[1] = '\0'; >>> printf("%s\n", string[1]); >The Encore/Umax C compiler emits \022 \012. So, like, what's \022? My >ASCII table says it's a "dc2". In this case, the fact that it's DC2 is immaterial. You passed a pointer to location 0 to printf, so it printed the string that happened to be at location 0 in memory, which appears to be \022. Barry Margolin Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar