• <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 丑石 閱讀(293) 評(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)論   


            My Links

            Blog Stats

            News

            常用鏈接

            留言簿(1)

            隨筆分類(13)

            隨筆檔案(17)

            文章檔案(1)

            相冊(cè)

            收藏夾(1)

            Friends' blog

            useful sites

            搜索

            積分與排名

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            欧美黑人激情性久久| 97久久天天综合色天天综合色hd| 人人狠狠综合久久亚洲| 久久久久久国产精品无码下载| 久久强奷乱码老熟女网站| 久久九九有精品国产23百花影院| 久久精品免费网站网| 久久久久久久久久久久久久 | 欧美久久久久久| 国产免费久久精品99久久| 午夜精品久久久久久久无码| 国产精品美女久久久m| 波多野结衣久久| 99热都是精品久久久久久| 色欲综合久久中文字幕网| 国内精品久久国产| 热综合一本伊人久久精品 | 2021国产精品午夜久久| 99久久精品这里只有精品| 久久精品无码专区免费青青| 四虎国产精品成人免费久久| 国内精品免费久久影院| 色综合久久综合网观看| 精品熟女少妇a∨免费久久| 99久久精品免费看国产一区二区三区| 久久久精品免费国产四虎| 久久精品国产亚洲AV大全| 久久精品国产男包| 亚洲精品蜜桃久久久久久| 99蜜桃臀久久久欧美精品网站| 女同久久| 超级97碰碰碰碰久久久久最新 | 国产精品美女久久福利网站| 性做久久久久久免费观看| 欧美一级久久久久久久大| 区亚洲欧美一级久久精品亚洲精品成人网久久久久 | 蜜桃麻豆WWW久久囤产精品| 思思久久99热只有频精品66| 伊人久久国产免费观看视频| 色天使久久综合网天天| 久久精品免费一区二区|