• <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 天津大學(xué)計(jì)算機(jī)學(xué)院 常興龍

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



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


            My Links

            Blog Stats

            News

            常用鏈接

            留言簿(1)

            隨筆分類(13)

            隨筆檔案(17)

            文章檔案(1)

            相冊

            收藏夾(1)

            Friends' blog

            useful sites

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            久久av免费天堂小草播放| 青春久久| 观看 国产综合久久久久鬼色 欧美 亚洲 一区二区| 色综合久久久久无码专区| 久久综合九色综合欧美狠狠| 亚洲精品WWW久久久久久 | 无码人妻少妇久久中文字幕蜜桃| 久久久久女人精品毛片| 国产2021久久精品| 久久亚洲精品无码AV红樱桃| 国产精品无码久久久久| 久久国产精品无码HDAV| 色婷婷综合久久久久中文字幕| 久久精品一本到99热免费| 亚洲伊人久久精品影院| 亚洲AV日韩精品久久久久久| 精品国产乱码久久久久软件| 国产精品久久久久天天影视| 中文字幕亚洲综合久久菠萝蜜| 久久久久亚洲精品天堂| 色欲综合久久躁天天躁| 国产精品激情综合久久| 国产精品久久午夜夜伦鲁鲁| 亚洲国产精品无码久久一线| 亚洲国产精品嫩草影院久久| 久久精品亚洲乱码伦伦中文| 91久久精品电影| AA级片免费看视频久久| 久久99精品久久久久久 | 久久免费观看视频| 精品久久久久久无码免费| 国产成人久久激情91| 国产精品久久国产精麻豆99网站| 色欲av伊人久久大香线蕉影院| 99精品国产免费久久久久久下载| 亚洲国产成人精品久久久国产成人一区二区三区综 | 国产91色综合久久免费| 国产亚洲精品自在久久| 国产精品九九九久久九九| 国产成人久久精品二区三区| 久久久久久极精品久久久|