Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!casbah.acns.nwu.edu!nucsrl!igloo!ddsw1!olsa99!rascal!theo From: theo@rascal.UUCP (T. Kramer) Newsgroups: comp.lang.c Subject: Re: New 'n' Improved comp.lang.c FAQ List Message-ID: <1512@rascal.UUCP> Date: 9 Apr 91 07:06:39 GMT References: <910401.0xf001@etiquette.uu.net> <1991Apr1.203024.19679@unlv.edu> <906@zeusa.UUCP> Reply-To: theo@rascal.UUCP (T. Kramer) Organization: Rascal Systems Lines: 22 In article <906@zeusa.UUCP> hendrik@zeusa.UUCP (Hendrik Vermooten) writes: >In article <1991Apr1.203024.19679@unlv.edu>, grover@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@rascal | Roll on C++ | +-----------------------------+----------------------------------------------+