• <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>

            linux&c++ R&D

            programing is a pleasure!

            How to express string semantic (1)?

               String processing is very important in programming! How to express string semantic ?
            There are many methods with doing it!   Some are listed  below!
            (1) char array and pointer.
            This  is always used in c. The advantage  is high time efficiency,beause it manipulate  memory address directly! However it  produce errors very easily and isn't very convenient! Some tips may be helpful!
            #const string definition: 

             const char *str="hello" or 
             
            const char str[]="hello"

            #string definition:

               char str[LEN]; //LEN is compling-time const!
               char *str=new char[ILEN]  //LEN is valid value!
               but don't forget delete []str;
            #functions which relate to string, definined in string.h/stdio.h etc
             such as:
              strcmp,strlen,strcpy/strncpy etc! please refer to 
              http://www.cppreference.com/stdstring/index.html
              some function is worth learning! Attention please!
              sprintf() is useful! 

            #include <stdio.h>
              
            int sprintf( char *buffer, const char *format,  );
              
            char string[50]; 
               sprintf( string, 
            "Hello %s",world );

                 The following code uses sprintf() to convert an integer into a string of characters: 

            char result[100];
               
            int num = 24;
               sprintf( result, 
            "%d", num );              

               This code is similar, except that it converts a floating-point number into an array of characters: 

            char result[100];
               
            int num = 24;
               sprintf( result, 
            "%d", num );              

            snprintf() is like sprintf but with length argument!
            (continuing...)


            posted on 2007-04-18 23:31 丑石 閱讀(293) 評(píng)論(1)  編輯 收藏 引用

            Feedback

            # re: How to express string synatic effectively(1)? 2007-04-19 03:49 天津大學(xué)計(jì)算機(jī)學(xué)院 常興龍

            寫得不錯(cuò),可以發(fā)在其它技術(shù)區(qū),而非是新手區(qū)了。。。。  回復(fù)  更多評(píng)論   


            My Links

            Blog Stats

            News

            常用鏈接

            留言簿(1)

            隨筆分類(13)

            隨筆檔案(17)

            文章檔案(1)

            相冊(cè)

            收藏夾(1)

            Friends' blog

            useful sites

            搜索

            積分與排名

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            久久精品男人影院| 久久www免费人成精品香蕉| 免费一级欧美大片久久网| 久久国产成人亚洲精品影院| 色播久久人人爽人人爽人人片aV| 亚洲成av人片不卡无码久久| 久久久久久午夜成人影院| 国产 亚洲 欧美 另类 久久| 久久午夜无码鲁丝片秋霞| 日韩精品国产自在久久现线拍| 久久精品国产精品亚洲人人| 亚洲国产美女精品久久久久∴ | 日韩久久久久久中文人妻| 国产成人精品白浆久久69| 久久午夜福利电影| 99久久99久久久精品齐齐| 久久久久久A亚洲欧洲AV冫 | 国产成人无码精品久久久免费 | 久久婷婷色综合一区二区| 久久99国内精品自在现线| 亚洲日本va午夜中文字幕久久 | 久久精品国产乱子伦| 色噜噜狠狠先锋影音久久| 久久中文字幕人妻熟av女| 99久久精品国产毛片| 久久精品国产久精国产| 国产成人精品久久| 亚洲国产成人久久综合一区77| 99久久免费国产精精品| 免费无码国产欧美久久18| 久久精品国产亚洲Aⅴ蜜臀色欲| 久久国产精品成人免费| 精品国产乱码久久久久久1区2区| 久久九九兔免费精品6| 久久久久久国产精品美女| 日本免费一区二区久久人人澡| 999久久久无码国产精品| 久久久久久亚洲Av无码精品专口| 一本色道久久综合狠狠躁| 伊人久久精品无码av一区| 狠狠色丁香久久婷婷综合|