Esempio n. 1
0
main ()
{
	char s[MAXLEN];
    
    printf("INT_MAX: %d\n", INT_MAX);
    itoa1(INT_MAX, s);
    printf("Buffer : %s\n", s);
	printf("INT_MIN: %d\n", INT_MIN);
    itoa1(INT_MIN, s);
    printf("Buffer : %s\n", s);
    
    return 0;

}
Esempio n. 2
0
int itoa1(int n, char s[], int start)
{
	char ch = (char) abs(n % 10) + '0';
	int i = (n / 10) ? itoa1(n / 10, s, start) : start;
	s[i] = ch;
	return i + 1;
}
Esempio n. 3
0
void itoa(int n, char s[])
{
	int start = 0;
	if (n < 0) {
		s[0] = '-';
		start = 1;
	}
	itoa1(n, s, start);
}
Esempio n. 4
0
File: common.c Progetto: abl/peapod
void format_lap(time_t lap_time, char* buffer) {
    int hundredths = (lap_time / 100) % 10;
    int seconds = (lap_time / 1000) % 60;
    int minutes = (lap_time / 60000) % 60;
    int hours = lap_time / 3600000;

    itoa2(hours, &buffer[0]);
    buffer[2] = ':';
    itoa2(minutes, &buffer[3]);
    buffer[5] = ':';
    itoa2(seconds, &buffer[6]);
    buffer[8] = '.';
    itoa1(hundredths, &buffer[9]);
}
Esempio n. 5
0
int main(int argc, char const *argv[])
{
	itoa1();
	return 0;
}