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

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            久久99国产乱子伦精品免费| 日韩亚洲欧美久久久www综合网| 久久久久久国产精品美女| 97久久精品国产精品青草| 久久亚洲欧洲国产综合| 久久久久综合网久久| 久久影院午夜理论片无码 | 精品免费tv久久久久久久| 久久国产视屏| 精品久久久久中文字| 青青草国产成人久久91网| 亚洲а∨天堂久久精品| 精品久久久久久国产免费了| 99精品国产综合久久久久五月天| 久久亚洲AV无码精品色午夜麻豆| 久久久久久久综合日本| 久久综合香蕉国产蜜臀AV| 久久久久99精品成人片直播| 亚洲国产一成人久久精品| 亚洲熟妇无码另类久久久| 久久精品国产欧美日韩| a级成人毛片久久| 久久香综合精品久久伊人| 久久国产成人午夜AV影院| 国产一久久香蕉国产线看观看| 欧美久久久久久| 人妻少妇久久中文字幕| 亚洲色欲久久久久综合网| 综合久久一区二区三区 | 久久综合狠狠综合久久激情 | 国产精品久久国产精品99盘 | 蜜臀av性久久久久蜜臀aⅴ麻豆| 久久久久亚洲av成人无码电影 | 久久精品国产精品亜洲毛片| 久久91精品久久91综合| 婷婷综合久久狠狠色99h| 久久99国产精品一区二区| 国产精品18久久久久久vr | 久久久久亚洲AV无码观看| 国产精品久久新婚兰兰| 欧美激情一区二区久久久|