New 'n' Improved comp.lang.c FAQ List

Dave Gillett dgil at pa.reuter.COM
Thu Apr 4 06:41:01 AEST 1991


In <1991Apr1.203024.19679 at unlv.edu> grover at big-joe.cs.unlv.edu (Kevin Grover) writes:

>	A correct version of this program is:

>        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.

                                                   Dave



More information about the Comp.lang.c mailing list