• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            Prayer

            在一般中尋求卓越
            posts - 1256, comments - 190, trackbacks - 0, articles - 0
              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

            atoi函數源代碼

            Posted on 2010-09-06 13:13 Prayer 閱讀(7506) 評論(2)  編輯 收藏 引用 所屬分類: C/C++

            isspace(int x)
            {
             if(x==' '||x=='\t'||x=='\n'||x=='\f'||x=='\b'||x=='\r')
              return 1;
             else 
              return 0;
            }
            isdigit(int x)
            {
             if(x<='9'&&x>='0')        
              return 1;x`
             else
              return 0;

            }
            int atoi(const char *nptr)
            {
                    int c;              /* current char */
                    int total;         /* current total */
                    int sign;           /* if '-', then negative, otherwise positive */

                    /* skip whitespace */
                    while ( isspace((int)(unsigned char)*nptr) )
                        ++nptr;

                    c = (int)(unsigned char)*nptr++;
                    sign = c;           /* save sign indication */
                    if (c == '-' || c == '+')
                        c = (int)(unsigned char)*nptr++;    /* skip sign */

                    total = 0;

                    while (isdigit(c)) {
                        total = 10 * total + (c - '0');     /* accumulate digit */
                        c = (int)(unsigned char)*nptr++;    /* get next char */
                    }

                    if (sign == '-')
                        return -total;
                    else
                        return total;   /* return result, negated if necessary */
            }

             

            本文來自CSDN博客,轉載請標明出處:http://blog.csdn.net/udknight/archive/2007/10/22/1836799.aspx

            Feedback

            # re: atoi函數源代碼  回復  更多評論   

            2012-04-18 23:20 by 春秋十二月
            實現基本可以,但沒處理數據溢出和字符集的情況

            # re: atoi函數源代碼  回復  更多評論   

            2014-11-04 21:30 by 張瑞昌
            對啊,怎么源碼都沒處理溢出問題!
            国产成人久久久精品二区三区| 久久99久久99小草精品免视看| 人妻无码精品久久亚瑟影视| 色综合久久天天综线观看| 欧美一级久久久久久久大片| 新狼窝色AV性久久久久久| 99久久精品国产免看国产一区| 久久国产精品免费| 久久精品aⅴ无码中文字字幕重口| 国产精品99久久久久久www| 中文字幕无码久久久| 久久精品国产秦先生| 久久精品一本到99热免费| 国产精品久久久久久久| 久久久久久久精品成人热色戒| 色偷偷888欧美精品久久久| 99精品国产综合久久久久五月天 | 精品国产乱码久久久久久呢 | 久久er99热精品一区二区| 欧美激情精品久久久久久| 777米奇久久最新地址| 久久狠狠爱亚洲综合影院 | 午夜久久久久久禁播电影| 午夜福利91久久福利| 亚洲成人精品久久| 国产精品久久久久久| av无码久久久久久不卡网站 | 国内精品久久国产| 久久综合色之久久综合| 精品乱码久久久久久夜夜嗨 | 久久精品国产精品亚洲精品| 日韩精品久久久肉伦网站| 亚洲AV日韩精品久久久久久久| 久久只这里是精品66| 亚洲精品tv久久久久久久久久| 久久无码国产| 一极黄色视频久久网站| 久久午夜免费视频| 中文字幕久久精品无码| 久久午夜伦鲁片免费无码| 99久久久国产精品免费无卡顿|