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
",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;
}
他只是向前航行,脚下是沉静碧蓝的大海,而头顶是金色的太阳。
原文地址:https://www.cnblogs.com/bliss-/p/13922020.html