mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-18 21:02:34 +03:00
22 lines
352 B
C
22 lines
352 B
C
|
#include "stdio.h"
|
||
|
#include "stdlib.h"
|
||
|
#include "ctype.h"
|
||
|
|
||
|
/*
|
||
|
** itoa(n,s) - Convert n to characters in s
|
||
|
*/
|
||
|
void itoa(int n,char* s)
|
||
|
{
|
||
|
int sign;
|
||
|
char *ptr;
|
||
|
ptr = s;
|
||
|
if ((sign = n) < 0) n = -n;
|
||
|
do {
|
||
|
*ptr++ = n % 10 + '0';
|
||
|
} while ((n = n / 10) > 0);
|
||
|
if (sign < 0) *ptr++ = '-';
|
||
|
*ptr = '\0';
|
||
|
reverse(s);
|
||
|
}
|
||
|
|