• <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 閱讀(7505) 評論(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 張瑞昌
            對啊,怎么源碼都沒處理溢出問題!
            久久福利青草精品资源站免费| 91久久精品无码一区二区毛片| 手机看片久久高清国产日韩| 久久精品国产国产精品四凭 | 99久久精品久久久久久清纯| 蜜桃麻豆www久久| 久久伊人色| 久久国产精品成人片免费| 曰曰摸天天摸人人看久久久| 一级做a爰片久久毛片毛片| 久久久久免费看成人影片| 国产成人久久精品二区三区| 亚洲人成电影网站久久| 精品无码久久久久久尤物| 久久嫩草影院免费看夜色| 国产精品久久免费| 久久久久久精品免费看SSS| 国产免费福利体检区久久| 一本色道久久综合狠狠躁| 久久久久国产一区二区| 久久香蕉超碰97国产精品| 尹人香蕉久久99天天拍| 色噜噜狠狠先锋影音久久| 精品久久久久久无码专区| 国产一区二区久久久| 欧美色综合久久久久久| 91精品日韩人妻无码久久不卡| 亚洲精品tv久久久久久久久| 色婷婷久久综合中文久久一本| 久久久WWW成人免费精品| 91精品久久久久久无码| 久久香蕉一级毛片| 久久精品这里热有精品| AAA级久久久精品无码片| 亚洲第一极品精品无码久久| 久久人人爽人人人人片av| 色悠久久久久久久综合网| 久久婷婷五月综合97色直播| 欧美久久久久久精选9999| 亚洲а∨天堂久久精品9966| 热久久最新网站获取|