• <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 天津大學計算機學院 常興龍

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


            My Links

            Blog Stats

            News

            常用鏈接

            留言簿(1)

            隨筆分類(13)

            隨筆檔案(17)

            文章檔案(1)

            相冊

            收藏夾(1)

            Friends' blog

            useful sites

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            女人高潮久久久叫人喷水| 狠狠精品久久久无码中文字幕 | 国产精品久久99| 麻豆精品久久精品色综合| 久久99精品久久久久久齐齐| 伊人久久成人成综合网222| 无码伊人66久久大杳蕉网站谷歌| 91精品国产9l久久久久| 国产亚洲色婷婷久久99精品91| 亚洲日本va午夜中文字幕久久| 国产情侣久久久久aⅴ免费| 久久人妻少妇嫩草AV无码蜜桃| 亚洲欧美日韩中文久久| 久久五月精品中文字幕| 久久99精品久久久久久动态图| 久久天天躁狠狠躁夜夜av浪潮 | 99久久精品免费看国产一区二区三区 | 久久最新精品国产| 久久综合香蕉国产蜜臀AV| 久久精品亚洲乱码伦伦中文| 国产麻豆精品久久一二三| 久久国产视频99电影| 国产麻豆精品久久一二三| 久久人人爽人人爽人人片AV东京热 | 精品国产日韩久久亚洲| 99热都是精品久久久久久| 精品国产VA久久久久久久冰 | 国产精品九九久久免费视频| 亚洲色大成网站www久久九| 亚洲欧洲久久久精品| 国产99久久久国产精免费| 久久精品这里热有精品| jizzjizz国产精品久久| 久久久久免费看成人影片| 久久精品国产亚洲av麻豆蜜芽| 久久无码AV中文出轨人妻| 久久久99精品一区二区| 久久人人爽人人精品视频| 亚洲国产成人乱码精品女人久久久不卡 | 久久综合九色综合久99| 久久精品国产72国产精福利|