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

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            狠狠干狠狠久久| 中文字幕热久久久久久久| 99久久婷婷国产综合亚洲| 久久久噜噜噜www成人网| 久久免费视频观看| 久久九九免费高清视频| 天天爽天天狠久久久综合麻豆| 国产精品毛片久久久久久久| 久久99精品久久久久久噜噜| 久久精品国产99国产精品亚洲| 狠狠色丁香久久综合婷婷| 久久久久亚洲精品男人的天堂| 久久免费看黄a级毛片| 国产精品亚洲美女久久久| 亚洲精品无码久久久久| 久久精品国产一区二区三区不卡| 国产精品久久久久久久人人看| 久久福利青草精品资源站| 97久久国产综合精品女不卡| 欧美伊香蕉久久综合类网站| 亚洲中文久久精品无码| 久久久久久国产a免费观看不卡| 久久久女人与动物群交毛片| 人妻无码久久精品| 久久久久久久综合综合狠狠| 国产精品久久99| 久久综合给合久久狠狠狠97色69| 午夜精品久久久久9999高清| 久久电影网2021| 狠狠色婷婷综合天天久久丁香 | 国产成人精品综合久久久| 久久99精品久久久久婷婷| 中文成人无码精品久久久不卡 | 久久久久国产成人精品亚洲午夜| 国产精品久久久久影视不卡| 久久综合给久久狠狠97色| 热re99久久精品国99热| 久久精品午夜一区二区福利| 久久综合给合久久狠狠狠97色| 欧美牲交A欧牲交aⅴ久久| 国产精品一区二区久久不卡 |