Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!jethro!issy!fguille From: fguille@issy (Francois Guillemot - Sun France Software Support) Newsgroups: comp.lang.c Subject: Re: New 'n' Improved comp.lang.c FAQ List Message-ID: <3739@jethro.Corp.Sun.COM> Date: 2 Apr 91 11:38:36 GMT References: <910401.0xf001@etiquette.uu.net> <1991Apr1.203024.19679@unlv.edu> <31946@shamash.cdc.com> Sender: news@jethro.Corp.Sun.COM Reply-To: fguille@France.Sun.COM Organization: Sun Microsystems, Inc. Mt. View, Ca. Lines: 24 bls@u02.svl.cdc.com (Brian Scearce) writes: Almost, but not quite, Mr. Grover. The *really* correct version of this: char *itoa(int i) { static char retbuf[5]; /* biggest int: 32768 */ sprintf(retbuf, "%d", i); return retbuf; } Should'nt the *really really correct* version allocate an extra character in the retbuf array for the end of string delimiter \0 ??? I will just say that a *just a little bit more correct* version should read: static char retbuf[6]; /* biggest int: 32768 */ -- Francois GUILLEMOT SUN France fguille@France.Sun.COM