Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!pacbell.com!pacbell!ptsfa!dmturne From: dmturne@PacBell.COM (Dave Turner) Newsgroups: comp.lang.c Subject: Re: New 'n' Improved comp.lang.c FAQ List Message-ID: <6092@ptsfa.PacBell.COM> Date: 4 Apr 91 20:17:05 GMT References: <910401.0xf001@etiquette.uu.net> <1991Apr1.203024.19679@unlv.edu> <849@saxony.pa.reuter.COM> Reply-To: dmturne@PacBell.COM (Dave Turner) Distribution: na Organization: Pacific * Bell, San Ramon, CA Lines: 23 In article <849@saxony.pa.reuter.COM> dgil@pa.reuter.COM (Dave Gillett) writes: .In <1991Apr1.203024.19679@unlv.edu> grover@big-joe.cs.unlv.edu (Kevin Grover) writes: .> char *itoa(int i) .> { .> static char retbuf[5]; /* biggest int: 32769 */ .> sprintf(retbuf, "%d", i); .> return retbuf; .> } . Bzzzt! . For this purpose, the "biggest" integer (assuming 16-bit ints, as Kevin .has...) is . -32768 . That's *6* characters long. Bzzzt! Counting the \0 placed at the end of the string by sprintf, that's *7* characters long. -- Dave Turner 415/823-2001 {att,bellcore,sun,ames,decwrl}!pacbell!dmturne