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

            Feedback

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

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



            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            My Links

            Blog Stats

            News

            常用鏈接

            留言簿(1)

            隨筆分類(13)

            隨筆檔案(17)

            文章檔案(1)

            相冊(cè)

            收藏夾(1)

            Friends' blog

            useful sites

            搜索

            積分與排名

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            亚洲午夜福利精品久久| 三级片免费观看久久| 久久大香香蕉国产| 99久久国产热无码精品免费| 国产69精品久久久久9999| 午夜精品久久久久久久无码| 久久九九久精品国产免费直播| 亚洲香蕉网久久综合影视| 大美女久久久久久j久久| 久久久久国产精品嫩草影院| 91久久精品视频| 人人狠狠综合久久亚洲88| 日本欧美久久久久免费播放网 | 青青热久久综合网伊人| 中文字幕无码久久精品青草| 亚洲综合久久综合激情久久| 久久男人Av资源网站无码软件| 亚洲精品美女久久久久99小说 | 久久久中文字幕| 无码国内精品久久人妻蜜桃| 一本一本久久A久久综合精品| 精品国产青草久久久久福利 | 国产激情久久久久影院老熟女| 久久久久久亚洲AV无码专区 | 伊人久久免费视频| 久久国产精品99精品国产| 久久一日本道色综合久久| 久久久久久久精品成人热色戒| 久久久久亚洲AV综合波多野结衣| 国产福利电影一区二区三区,免费久久久久久久精 | 午夜肉伦伦影院久久精品免费看国产一区二区三区| 男女久久久国产一区二区三区| 伊人久久精品影院| 久久91精品国产91久| 久久久精品国产sm调教网站| 午夜精品久久久久久久| 色8久久人人97超碰香蕉987| 麻豆亚洲AV永久无码精品久久| 91精品国产91久久久久福利| 国产亚洲精午夜久久久久久| 久久久这里有精品中文字幕|