• <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

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            亚洲国产精品无码成人片久久| 无码人妻精品一区二区三区久久久 | 精品亚洲综合久久中文字幕| 久久综合给合久久狠狠狠97色| 欧美精品乱码99久久蜜桃| 免费一级欧美大片久久网| 日韩中文久久| 久久99精品九九九久久婷婷| 久久w5ww成w人免费| 久久亚洲国产成人影院网站 | 亚洲AV无码久久精品狠狠爱浪潮 | 国产欧美久久久精品影院| 品成人欧美大片久久国产欧美...| 亚洲性久久久影院| 久久国产成人| 国产精品成人精品久久久| 久久精品国产99国产电影网 | 日韩久久无码免费毛片软件| 国产成人精品白浆久久69| 国产亚州精品女人久久久久久| 久久人妻无码中文字幕| 无码人妻精品一区二区三区久久久 | 国产91久久综合| 久久久久99精品成人片| 日韩电影久久久被窝网| 亚洲精品美女久久久久99小说| 一本色综合久久| 国产成人久久AV免费| 国产精品美女久久久免费| 欧美性大战久久久久久| 精品国产综合区久久久久久| 亚洲伊人久久成综合人影院| 色妞色综合久久夜夜| 99久久精品国产一区二区蜜芽 | AV无码久久久久不卡蜜桃| 亚洲一本综合久久| 国内精品久久久久久久久电影网| 国产亚洲精久久久久久无码| 99久久免费只有精品国产| 亚洲愉拍99热成人精品热久久 | 伊人久久大香线蕉综合热线|