• <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 閱讀(7499) 評論(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 張瑞昌
            對啊,怎么源碼都沒處理溢出問題!
            久久精品国产亚洲av麻豆小说 | 久久99久久99精品免视看动漫| 久久久久久无码国产精品中文字幕 | 久久精品中文字幕久久| 99久久综合狠狠综合久久| 国产精品久久久久久久app| 久久久久久久久无码精品亚洲日韩 | 久久www免费人成精品香蕉| 一本久久综合亚洲鲁鲁五月天| 欧美亚洲色综久久精品国产| 国产精品18久久久久久vr| 久久久久99精品成人片三人毛片 | 久久午夜夜伦鲁鲁片免费无码影视 | 91精品国产91热久久久久福利| 亚洲伊人久久综合中文成人网| 国内精品人妻无码久久久影院 | 狠色狠色狠狠色综合久久| 色婷婷久久综合中文久久一本| 久久精品男人影院| 久久久国产精品亚洲一区| 久久AV高潮AV无码AV| 久久99这里只有精品国产| 国产成人久久精品麻豆一区| 亚洲国产精品无码久久| 香蕉久久夜色精品国产尤物| 久久精品无码av| 久久精品国产福利国产琪琪| 久久精品国产精品亚洲精品| 国产成人无码久久久精品一| 久久精品九九亚洲精品| 老色鬼久久亚洲AV综合| 久久夜色精品国产噜噜噜亚洲AV | 99久久成人国产精品免费| 天天爽天天狠久久久综合麻豆| 一本一道久久综合狠狠老| 亚洲狠狠婷婷综合久久蜜芽| 久久精品夜夜夜夜夜久久| 国产三级久久久精品麻豆三级| 精品国产乱码久久久久久郑州公司 | 中文字幕热久久久久久久| 99久久国产精品免费一区二区|