• <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 天津大學計算機學院 常興龍

            寫得不錯,可以發(fā)在其它技術區(qū),而非是新手區(qū)了。。。。  回復  更多評論   


            My Links

            Blog Stats

            News

            常用鏈接

            留言簿(1)

            隨筆分類(13)

            隨筆檔案(17)

            文章檔案(1)

            相冊

            收藏夾(1)

            Friends' blog

            useful sites

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            亚洲美日韩Av中文字幕无码久久久妻妇| 久久精品国产亚洲5555| 久久久久久a亚洲欧洲aⅴ| 久久天天躁狠狠躁夜夜不卡| 色诱久久久久综合网ywww| 国产综合免费精品久久久| 久久久一本精品99久久精品88| 久久精品国产半推半就| 一级a性色生活片久久无少妇一级婬片免费放 | 91精品国产高清久久久久久io| 久久久久久久久久久久久久| 性欧美大战久久久久久久久 | 国内精品久久久久影院优| 久久久久精品国产亚洲AV无码| 亚洲狠狠久久综合一区77777| 精品久久久久久久国产潘金莲| 亚洲成人精品久久| 国产成人精品久久| 久久久久无码精品国产app| 欧美激情精品久久久久久久| 国产成人香蕉久久久久| 久久久久无码中| 成人午夜精品无码区久久| 亚洲综合伊人久久综合| 国产精品美女久久久久| 亚洲伊人久久综合中文成人网| 国内精品伊人久久久久影院对白| 无码精品久久一区二区三区 | 久久中文字幕精品| 国产精品美女久久久久网| 国产成人久久精品麻豆一区| 久久93精品国产91久久综合| 久久精品国产国产精品四凭| 欧美激情精品久久久久久久九九九| 久久久久国产精品麻豆AR影院| 日韩久久久久久中文人妻| 国产成人精品久久| 欧美久久综合性欧美| 亚洲精品tv久久久久久久久| 久久国产乱子伦精品免费午夜| 久久99精品国产麻豆宅宅|