Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
647 | andrew_pro | 1 | #include "stdio.h" |
2 | #include "stdlib.h" |
||
3 | #include "ctype.h" |
||
4 | |||
5 | /* |
||
6 | ** itoa(n,s) - Convert n to characters in s |
||
7 | */ |
||
8 | void itoa(int n,char* s) |
||
9 | { |
||
10 | int sign; |
||
11 | char *ptr; |
||
12 | ptr = s; |
||
13 | if ((sign = n) < 0) n = -n; |
||
14 | do { |
||
15 | *ptr++ = n % 10 + '0'; |
||
16 | } while ((n = n / 10) > 0); |
||
17 | if (sign < 0) *ptr++ = '-'; |
||
18 | *ptr = '\0'; |
||
19 | reverse(s); |
||
20 | }>> |
||
21 |