Error[8]: Undefined offset: 1, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

【C】strtoll 函数用例
int main() {
    unsigned long s = CHAR_BIT * sizeof(1l); // bit size; must be power of 2
    unsigned long mask = ~0UL;
    printf("s = %lu  n", s);
    pb(s);
    printf("s = %lu  n", mask);
    pb(mask);

    unsigned long i = rev(1l);
    printf("s = %lu  n", i);
    pb(i);


    char str[30] = " 2030300 This is test";
    char *ptr;
    long ret;

    ret = strtoll(str, &ptr, 10);
    printf("数字(无符号长整数)是 %ldn", ret);
    printf("n字符串部分是 |%s|", ptr);

    if (isspace(((char*)str)[0])){
        if (ptr[0] != ''){
            printf("nptr[0] != '[+++]' |%s|", ptr);
        }
        printf("n isspace |%s|", ptr);
    }

}

|| 结果:
数字(无符号长整数)是 2030300

字符串部分是 | This is test|
ptr[0] != '' | This is test|
 isspace | This is test|
Process finished with exit code 0

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 166, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
【C】strtoll 函数用例_随笔_内存溢出

【C】strtoll 函数用例

【C】strtoll 函数用例,第1张

【C】strtoll 函数用例
int main() {
    unsigned long s = CHAR_BIT * sizeof(1l); // bit size; must be power of 2
    unsigned long mask = ~0UL;
    printf("s = %lu  n", s);
    pb(s);
    printf("s = %lu  n", mask);
    pb(mask);

    unsigned long i = rev(1l);
    printf("s = %lu  n", i);
    pb(i);


    char str[30] = " 2030300 This is test";
    char *ptr;
    long ret;

    ret = strtoll(str, &ptr, 10);
    printf("数字(无符号长整数)是 %ldn", ret);
    printf("n字符串部分是 |%s|", ptr);

    if (isspace(((char*)str)[0])){
        if (ptr[0] != ''){
            printf("nptr[0] != '' |%s|", ptr);
        }
        printf("n isspace |%s|", ptr);
    }

}

|| 结果:
数字(无符号长整数)是 2030300

字符串部分是 | This is test|
ptr[0] != '' | This is test|
 isspace | This is test|
Process finished with exit code 0

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5702864.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存