[ CnUnix ] in KIDS 글 쓴 이(By): leesl (Nara) 날 짜 (Date): 2006년 2월 1일 수요일 오전 01시 13분 50초 제 목(Title): Re: [질문] C 에서 itoa 이런경우 프로그램이 복잡한 경우가 아니라면 itoa2함수내에서 여러개 정적 배열을 잡아서 처리하는 방법이 메모리 할당하거나 다른 방법에 비해 간단해서 많이 이용하는 것 같습니다. char * itoa2(int n) { static int cnt; static char buf[10][100]; int pos; pos = cnt % 10; printf("cnt: %d\n", cnt); sprintf(buf[pos], "%d", n); // 실제로는 요상한 리포매팅 cnt++; return buf[pos]; } |