New 'n' Improved comp.lang.c FAQ List
Francois Guillemot - Sun France Software Support
fguille at issy
Tue Apr 2 21:38:36 AEST 1991
bls at 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 at France.Sun.COM
More information about the Comp.lang.c
mailing list