#include #include #include #include #include #define DEFAULT_NUM_LEN 512 char *itoa(long num, char *strnum, size_t size){ int isNegative = 0; if(num == 0){ strnum[0] = '0'; strnum[1] = '\0'; return strnum; } if(num < 0){ isNegative = 1; num = -num; } int counter = 0; while(num > 0 && counter <(int)(size-1)){ strnum[counter] = num % 10 + '0'; num /= 10; counter ++; } if(isNegative){ strnum[counter] = '-'; counter++; } strnum[counter] = '\0'; for(int i=0; i 0); return 0; }