RE: [Dev-C++] itoa - atoi : another implementation
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <iv...@em...> - 2003-04-02 11:46:32
|
My own contribution to this entirely unneded function:
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
char *itoa(int i)
{
size_t Length;
char *p;
int temp=i;
for(Length=0; temp/=10; Length++)
;
p=malloc((Length+1)*sizeof(i));
sprintf(p, "%d", i);
return p;
}
Why would anyone need itoa()? With sprinf() one can easily do the
conversion.
sprintf(s,"%d", i);
Ioannis Vranos
* Programming pages: http://www.noicys.freeurl.com
* Alternative URL: http://run.to/noicys
|