1 #include <stdio.h> 2 #include <stdlib.h> 3 4 #define INT_MAX_OCT_DIGITS 5 5 6 char *itoo(int n); 7 8 int main (void) 9 { 10 char *arr; 11 arr = itoo(32211); 12 printf("%s\n", arr); 13 14 free(arr); 15 return 0; 16 } 17 18 char *itoo(int n) 19 { 20 char *arr; 21 22 arr = (char *)calloc(INT_MAX_OCT_DIGITS + 1, sizeof(char)); 23 sprintf(arr, "%o", n); 24 25 return arr; 26 }