• <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一区二区三区久久| 久久97久久97精品免视看秋霞| 一级A毛片免费观看久久精品| 欧美日韩成人精品久久久免费看| 久久伊人五月天论坛| 伊人久久大香线蕉亚洲| 亚洲精品高清久久| 久久精品成人欧美大片| 亚洲午夜精品久久久久久人妖| 亚洲中文字幕伊人久久无码| 国内精品久久久久影院日本| 狠狠色综合久久久久尤物| 久久精品中文字幕一区| 精品久久久久久无码中文字幕| 久久精品国产亚洲av麻豆图片| 狠狠色丁香婷婷久久综合不卡| 色天使久久综合网天天| 青青草国产精品久久| 久久久久亚洲av无码专区喷水| 日韩亚洲国产综合久久久| 国产成人精品久久亚洲高清不卡 | 麻豆av久久av盛宴av| 亚洲国产成人久久综合一| 色婷婷综合久久久久中文| 日日狠狠久久偷偷色综合0| 国产精品午夜久久| 精品久久一区二区三区| 久久午夜羞羞影院免费观看| 久久久这里有精品| 久久亚洲色一区二区三区| 久久国产影院| 久久精品国产亚洲Aⅴ蜜臀色欲| 狠狠狠色丁香婷婷综合久久五月| 中文字幕久久久久人妻| 久久九九兔免费精品6| 久久久久久久精品成人热色戒| 亚洲精品国精品久久99热| 伊人色综合九久久天天蜜桃| 日韩亚洲国产综合久久久| 久久久久久伊人高潮影院| 性做久久久久久久|