int 换成 字符串 (不用 itoa)
/* * author:lx * date:2011-10-04 * brief: convent int to string */ #include <stdio.h> #include <stdlib.h> void con_string( int a ) { int m = 10; char p[6]; int c = 1; char *q = p; while ( a != 0 ) { c = a % m; a = a / m; *q = c + '0'; q++; } *q = '\0'; printf( "%s\n", p ); } int main( void ) { int a = 12345; con_string( a ); exit( 0 ); }