❶ 將一個整形轉換為字元串
試試這個答案,http://www.cnblogs.com/ahuangliang/p/3602441.html
#defineBASE_MAX(26+10)
charconst*itostr(intx,intbase)
{
/*map居中,支技負余數*/
staticcharconst*constmap=
&""
""
[BASE_MAX-1];
/*靜態緩沖,不支持多線程,每次調用都覆蓋上次的值*/
staticcharbuf[BASE_MAX];
intoldx;
/*從緩沖尾部逆向使用*/
char*p=buf+sizeof(buf)-1;
*p='