• <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 丑石 閱讀(290) 評論(1)  編輯 收藏 引用

            Feedback

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

            寫得不錯,可以發在其它技術區,而非是新手區了。。。。  回復  更多評論   


            My Links

            Blog Stats

            News

            常用鏈接

            留言簿(1)

            隨筆分類(13)

            隨筆檔案(17)

            文章檔案(1)

            相冊

            收藏夾(1)

            Friends' blog

            useful sites

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            国产∨亚洲V天堂无码久久久| 久久久久久久久无码精品亚洲日韩 | 久久99国产精品尤物| 日本WV一本一道久久香蕉| 伊人久久大香线蕉成人| 一本一本久久A久久综合精品| 久久精品国产2020| 97久久精品无码一区二区| 久久精品亚洲精品国产欧美| 久久精品桃花综合| 久久se精品一区二区| 久久香综合精品久久伊人| 国产精品99久久久久久宅男小说| 国产精品久久久久久久久| 久久久久久久尹人综合网亚洲 | 亚洲欧洲精品成人久久曰影片| 久久精品蜜芽亚洲国产AV| 久久这里只有精品久久| 久久精品国产99国产精品| 久久久久99精品成人片欧美| 99久久国产亚洲综合精品| 天天爽天天狠久久久综合麻豆| 日本福利片国产午夜久久| 日韩人妻无码精品久久久不卡| 久久本道久久综合伊人| 午夜精品久久久久久| 久久精品中文字幕第23页| 精品久久久无码人妻中文字幕豆芽| 婷婷久久精品国产| 精品久久一区二区| 久久久久国产精品麻豆AR影院 | 久久亚洲日韩看片无码| 国产精品18久久久久久vr| 香蕉久久夜色精品国产2020| 免费国产99久久久香蕉| 日本久久久久亚洲中字幕| 久久人做人爽一区二区三区| 欧美久久久久久精选9999| 久久精品国内一区二区三区| 思思久久精品在热线热| 欧美久久久久久精选9999|