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

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            2021精品国产综合久久| 91亚洲国产成人久久精品| 久久久无码精品午夜| 精品国产日韩久久亚洲| 久久热这里只有精品在线观看| 看久久久久久a级毛片| 99久久亚洲综合精品成人| 久久996热精品xxxx| 亚洲AV无码成人网站久久精品大| 久久久免费精品re6| 久久夜色精品国产亚洲av| 久久亚洲精品无码AV红樱桃| 欧美久久一级内射wwwwww.| 久久丫精品国产亚洲av| 久久无码一区二区三区少妇 | 久久久久久精品免费免费自慰| 亚洲中文字幕无码久久综合网| 国内精品免费久久影院| 亚洲AV成人无码久久精品老人| 精品免费久久久久国产一区| 麻豆成人久久精品二区三区免费| 少妇久久久久久被弄到高潮| 日韩亚洲欧美久久久www综合网 | 久久久久久免费视频| 日韩精品国产自在久久现线拍| 久久国产精品无码一区二区三区| 伊人久久成人成综合网222| 久久精品国产欧美日韩| 亚洲国产精品一区二区久久| 久久精品国产第一区二区三区| 人妻精品久久久久中文字幕一冢本| 中文字幕久久亚洲一区| 日本久久久久久久久久| 人妻系列无码专区久久五月天| 99久久精品国产一区二区三区 | 国内精品伊人久久久久影院对白 | 国产精品美女久久久久久2018| 久久久久成人精品无码中文字幕| 亚洲AV日韩精品久久久久久久| 色综合久久久久综合体桃花网| 伊人久久综合无码成人网|