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

T. Kramer theo at rascal.UUCP
Tue Apr 9 17:06:39 AEST 1991


In article <906 at zeusa.UUCP> hendrik at zeusa.UUCP (Hendrik Vermooten) writes:
>In article <1991Apr1.203024.19679 at unlv.edu>, grover at big-joe.cs.unlv.edu (Kevin Grover) writes:
>> > [misc deleted. . .]
>> > Q: Why doesn't this function work:
>> >
>> >         char *itoa(int i)
>> >         {
>> >         static char retbuf[5];         /* biggest int: 32769 */
>> >         sprintf("%d", retbuf, i);
>> >         return retbuf;
>> >         }
>
>WOW!


Another WOW on the sprintf statement which must read as follows:

    sprintf(retbuf, "%d", i);

+-----------------------------+----------------------------------------------+
| theo at rascal                 | Roll on C++                                  |
+-----------------------------+----------------------------------------------+



More information about the Comp.lang.c mailing list