• <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++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

            atoi函數(shù)源代碼

            Posted on 2010-09-06 13:13 Prayer 閱讀(7500) 評論(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函數(shù)源代碼  回復  更多評論   

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

            # re: atoi函數(shù)源代碼  回復  更多評論   

            2014-11-04 21:30 by 張瑞昌
            對啊,怎么源碼都沒處理溢出問題!
            国产成人综合久久精品红| 91秦先生久久久久久久| 久久无码中文字幕东京热 | 久久国产精品无码HDAV| 2021精品国产综合久久| 精品国产青草久久久久福利 | 99国产欧美精品久久久蜜芽| 久久噜噜电影你懂的| 欧美成人免费观看久久| 久久99精品久久久大学生| 国产精品美女久久久久| 天天综合久久一二三区| 高清免费久久午夜精品| 欧美激情一区二区久久久| 久久国产精品二国产精品| 国产精品久久久亚洲| 久久99久久99精品免视看动漫| 精品无码久久久久久国产| 国产综合久久久久| 亚洲精品白浆高清久久久久久 | 国内精品久久久久久野外| 偷偷做久久久久网站| 久久精品国产亚洲Aⅴ蜜臀色欲| 丁香五月网久久综合| 狼狼综合久久久久综合网| 久久婷婷五月综合97色直播| 日韩欧美亚洲综合久久影院Ds | Xx性欧美肥妇精品久久久久久| 亚洲日本va中文字幕久久| 狠狠色丁香婷婷久久综合五月| 日本精品久久久中文字幕| 久久棈精品久久久久久噜噜| 久久国产色av免费看| 久久丫忘忧草产品| 久久精品国产清自在天天线 | 久久婷婷五月综合色奶水99啪| 久久www免费人成看片| 97久久婷婷五月综合色d啪蜜芽| 一本久久综合亚洲鲁鲁五月天| 综合久久精品色| 亚洲精品美女久久久久99|