char * _itoa(int i, char *strout, int base)
{
  char *str = strout;
  int digit, sign = 0;
  if (< 0) {
    sign = 1;
    i *= -1;
  }
10    while(i) {
11      digit = i % base;
12      *str = (digit > 9) ? ('A' + digit - 10) : '0' + digit;
13      i = i / base;
14      str ++;
15    }
16    if(sign) {
17    *str++ = '-';
18    }
19    *str = '';
20    strrev(strout);
21    return strout;
22  }
23  int main(int argc, char* argv[])
24  {
25    char num[10];
26    int i = _atoi("-102", 10);
27      printf(_itoa(i, num, 10));
28  }
29 

You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.

 Vote 0

Similar topics related to this section

const char *,char * const, const char * const, alpha numeric, palindrome, convert case, string to int, int to string, reverse decimal digits, signed and unsigned compare, palindrome digits,

# C Programming Language (Prentice Hall Software)
# Let Us C Paperback - 2006 by Yashavant Kanetkar
# Understanding and Using C Pointers Core techniques for memory management
# Data Structures Using C and C++ Paperback - 1998
# Data Structures In C Paperback - August 11, 2008 by Noel Kalicharan