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

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            久久久久久亚洲Av无码精品专口| 欧美一区二区三区久久综合| 777久久精品一区二区三区无码| 粉嫩小泬无遮挡久久久久久| 久久99精品久久久久久秒播 | 伊人色综合久久天天| 精品少妇人妻av无码久久| 韩国无遮挡三级久久| 久久国产精品视频| 久久综合给合久久国产免费| 国产精品欧美久久久久天天影视| 亚洲а∨天堂久久精品| 久久国产精品-久久精品| 久久人人爽人人爽人人片AV麻豆| 久久久久99精品成人片试看| 久久无码人妻精品一区二区三区| 久久人人妻人人爽人人爽| 久久综合色区| 日韩亚洲欧美久久久www综合网| 亚洲一区精品伊人久久伊人| 国产91久久综合| MM131亚洲国产美女久久| 久久精品国产99国产精品亚洲| 伊人热人久久中文字幕| 国产99久久精品一区二区| 中文字幕无码精品亚洲资源网久久| 久久露脸国产精品| 国产精品一区二区久久精品无码| 99久久国产热无码精品免费| 亚洲va久久久噜噜噜久久狠狠| 亚洲精品无码久久久久AV麻豆| 久久99精品久久久久久秒播| 国产成人久久精品麻豆一区| 久久精品国产免费| 日本久久久精品中文字幕| 久久线看观看精品香蕉国产| 国产91色综合久久免费分享| 91久久福利国产成人精品| 久久97久久97精品免视看| 久久久久99精品成人片牛牛影视| 精品久久久久久无码人妻热|