c语言字符串转数字
/*两个函数实现将数字字符串转数字*/ //求 n次方 static unsigned long my_pow(int primitive ,int square){ if(square==0){ return 1; } int in=primitive; unsigned long out = primitive; int i = 1; for (i=1; i < square;i++){ out *= in; } return out; } //数字字符串转数字 static unsigned long my_atoll(const char *str,int len){ // printf("len:%d\r\n",len); unsigned long value = 0; int i = 0; for (i = 0; i < len;i++){ value += (*(str + i) - 48) * my_pow(10,len-(1+i)); } return value; }