/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* ========================================================================== */ /* */ /* itoa.h */ /* (c) 2006 Priyadarsan */ /* */ /* a program to convert integer to string */ /* (Original Code: http://www.freebookzone.com/others/itoa.h) */ /* Ex. usage file available at http://www.freebookzone.com/others/itoa.c */ /* */ /* ========================================================================== */ char* itoa (int n){ int i=0,j; char* s; char* u; s= (char*) malloc(17); u= (char*) malloc(17); do{ s[i++]=(char)( n%10+48 ); n-=n%10; } while((n/=10)>0); for (j=0;j<i;j++) u[i-1-j]=s[j]; u[j]='\0'; return u; }
URL: http://www.freebookzone.com/others/itoa.h