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

            Feedback

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

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


            My Links

            Blog Stats

            News

            常用鏈接

            留言簿(1)

            隨筆分類(13)

            隨筆檔案(17)

            文章檔案(1)

            相冊

            收藏夾(1)

            Friends' blog

            useful sites

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            久久本道久久综合伊人| 久久久久99精品成人片| 九九99精品久久久久久| 精品人妻伦一二三区久久| 久久婷婷激情综合色综合俺也去| 亚洲午夜久久久久久噜噜噜| 色99久久久久高潮综合影院| 欧美一区二区三区久久综合 | 99久久精品免费看国产| 久久久无码精品午夜| 99热都是精品久久久久久| 精品久久久久久无码专区| 一本色道久久综合狠狠躁| 无码任你躁久久久久久老妇| 久久香蕉超碰97国产精品 | 久久久精品国产sm调教网站| 久久99久久99精品免视看动漫| 国产成人精品久久亚洲高清不卡 | 久久AV无码精品人妻糸列| 国产精品日韩深夜福利久久| 69SEX久久精品国产麻豆| 久久久91精品国产一区二区三区| 久久永久免费人妻精品下载| 久久热这里只有精品在线观看| 思思久久99热免费精品6| 久久久久久久久久久久久久| 三上悠亚久久精品| 天天爽天天爽天天片a久久网| 久久国产一片免费观看| 久久久无码精品亚洲日韩蜜臀浪潮| 久久久久久免费视频| 久久99久久99精品免视看动漫| 亚洲伊人久久大香线蕉苏妲己| 久久久久久无码国产精品中文字幕| 一本久久综合亚洲鲁鲁五月天| 亚洲&#228;v永久无码精品天堂久久| 99久久久久| 天天综合久久久网| 72种姿势欧美久久久久大黄蕉| 精品国产乱码久久久久软件| 久久久久人妻精品一区三寸蜜桃|