Path: utzoo!attcan!uunet!lll-winken!csd4.milw.wisc.edu!mailrus!husc6!bu-cs!buengc!bph From: bph@buengc.BU.EDU (Blair P. Houghton) Newsgroups: comp.lang.c Subject: Re: An interesting behaviour in printf Message-ID: <2343@buengc.BU.EDU> Date: 19 Mar 89 04:29:08 GMT References: <960@Portia.Stanford.EDU> <15938@cup.portal.com> Reply-To: bph@buengc.bu.edu (Blair P. Houghton) Followup-To: comp.lang.c Distribution: na Organization: Boston Univ. Col. of Eng. Lines: 21 In article <15938@cup.portal.com> Tim_CDC_Roberts@cup.portal.com writes: >In <960@Portia.Stanford.EDU>, joe@hanauma (Joe Dellinger) asks: > >> string[0] = '*'; >> string[1] = '\0'; >> printf("%s\n", string[1]); > >No, I expect it to print out (null)\n. The '%s' format item expects to > >Trivia question: is the '(null)' output of printf standard or widespread? >I know that Microsoft C does this; do other compilers? The uVAX/Ultrix C compiler ignores it whole. The only thing the program emits is the \n. (I checked it by "funkyprint | od -bc". One char out. \012. More interesting than I expected. Smells broken.) The Encore/Umax C compiler emits \022 \012. So, like, what's \022? My ASCII table says it's a "dc2". --Blair "Gesundheit."