• <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 閱讀(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博客,轉(zhuǎn)載請標明出處: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| 久久久精品人妻一区二区三区蜜桃| 伊人久久综合精品无码AV专区| 亚洲中文字幕伊人久久无码| 久久精品国产亚洲av麻豆图片| 久久综合给合久久狠狠狠97色69| 91精品国产9l久久久久| 欧美精品一区二区精品久久| 欧美久久一级内射wwwwww.| 国产亚洲美女精品久久久2020| 91性高湖久久久久| 久久精品无码一区二区WWW| 久久久中文字幕| 一本久久a久久精品亚洲| 秋霞久久国产精品电影院| 久久亚洲精品无码aⅴ大香| 色综合久久88色综合天天| 亚洲综合日韩久久成人AV| 精品久久久久久无码免费| 久久99精品综合国产首页| 久久久久亚洲av成人网人人软件| 国产精品嫩草影院久久| 国内精品久久久久影院日本 | 国内精品伊人久久久久妇| 久久99精品综合国产首页| 亚洲va久久久噜噜噜久久| 一级做a爰片久久毛片看看| 国产激情久久久久影院小草| 国产美女久久精品香蕉69| 久久天天躁狠狠躁夜夜96流白浆| 伊人热热久久原色播放www| 久久久久女教师免费一区| 91精品久久久久久无码| 99久久国产热无码精品免费久久久久| 久久久久99精品成人片欧美| 无码国产69精品久久久久网站| 中文字幕久久波多野结衣av| 四虎国产精品成人免费久久| 久久午夜夜伦鲁鲁片免费无码影视| 久久九九久精品国产| 精品人妻伦九区久久AAA片69|