• <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ī)學(xué)院 常興龍

            寫得不錯,可以發(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

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            亚洲国产成人久久综合碰| 久久久亚洲裙底偷窥综合| 99久久精品午夜一区二区| 色综合久久久久综合体桃花网| 久久人妻无码中文字幕| 久久91综合国产91久久精品| 久久99精品久久久久久9蜜桃| 色播久久人人爽人人爽人人片AV| 亚洲中文字幕无码久久2020| 成人精品一区二区久久| 伊人久久大香线焦AV综合影院| 91久久福利国产成人精品| 99久久无色码中文字幕人妻| 久久久久久国产精品无码下载| 久久精品夜夜夜夜夜久久| 亚洲美日韩Av中文字幕无码久久久妻妇 | 伊人久久大香线蕉av一区| 人妻精品久久久久中文字幕一冢本| 1000部精品久久久久久久久| 久久一区二区三区99| 成人精品一区二区久久久| 久久99国产综合精品免费| 7777精品伊人久久久大香线蕉| 久久综合久久综合久久| 久久99精品国产自在现线小黄鸭| 怡红院日本一道日本久久 | 欧美日韩成人精品久久久免费看| 国产精品久久永久免费| 国产综合久久久久| 精品久久久无码人妻中文字幕豆芽 | 亚洲成色999久久网站| 精品久久久久香蕉网| 久久不射电影网| 欧美一区二区精品久久| 久久精品国产免费| 久久久久久久91精品免费观看| 青青草原1769久久免费播放| 免费观看成人久久网免费观看| 亚洲伊人久久大香线蕉苏妲己| 久久亚洲国产午夜精品理论片| 香港aa三级久久三级|