• <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) 評論(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

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            四虎国产精品成人免费久久| 亚洲综合熟女久久久30p| 久久精品国产只有精品66| 久久青青草原精品国产软件| 久久精品国产免费观看 | 亚洲欧美成人综合久久久| 99国产欧美精品久久久蜜芽| 久久精品国产亚洲精品2020| 久久综合久久久| 欧美国产成人久久精品| 狠狠狠色丁香婷婷综合久久俺| 亚洲欧美成人久久综合中文网| 精品久久久久久无码中文字幕一区| 国产午夜福利精品久久| 久久99毛片免费观看不卡| 色综合色天天久久婷婷基地| 久久无码高潮喷水| 91久久香蕉国产熟女线看| 亚洲AV无码久久| 久久精品国产欧美日韩| 精品久久久久久久无码| 久久夜色撩人精品国产| 久久国产精品-国产精品| 囯产极品美女高潮无套久久久 | 久久久久免费视频| 97久久精品无码一区二区| 亚洲午夜福利精品久久| 久久久精品一区二区三区| 香蕉久久夜色精品升级完成| 欧美激情精品久久久久久久| 青青青伊人色综合久久| 99久久成人国产精品免费 | 伊人久久大香线蕉av一区| 久久久久久噜噜精品免费直播| 99久久精品费精品国产| 99久久国产热无码精品免费 | 香蕉久久夜色精品国产尤物| 国产精品久久久久一区二区三区 | 精品国产91久久久久久久a| 国产91久久精品一区二区| 少妇久久久久久被弄高潮|