标签:span i++ ret logs data log define color itoa
//AToI #include <stdio.h> #define SIZE 200 int data[SIZE] = {4,5,6,7}; int AToI(int N,int Base) { int ret = 0; for(int i=0;i<N;i++) { ret = ret * 10 + data[i]; } return ret; } int main(void) { int num = AToI(4,10); printf("%d",num); return 0; }
//IToA #include <stdio.h> #define SIZE 20 int data[SIZE]; int IToA(int num,int Base,int Len) { for(int i=Len-1;i>=0;i--) { data[i] = num % Base; num /=10; } } int main(void) { int num = 10786; IToA(num,10,5); for(int i =0; i<5;i++) printf("%d",data[i]); return 0; }
标签:span i++ ret logs data log define color itoa
原文地址:http://www.cnblogs.com/xcsllll/p/6655773.html