• <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 丑石 閱讀(293) 評(píng)論(1)  編輯 收藏 引用

            Feedback

            # re: How to express string synatic effectively(1)? 2007-04-19 03:49 天津大學(xué)計(jì)算機(jī)學(xué)院 常興龍

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


            My Links

            Blog Stats

            News

            常用鏈接

            留言簿(1)

            隨筆分類(13)

            隨筆檔案(17)

            文章檔案(1)

            相冊(cè)

            收藏夾(1)

            Friends' blog

            useful sites

            搜索

            積分與排名

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            国产精品一区二区久久精品无码| 精品熟女少妇av免费久久| 狠狠色噜噜狠狠狠狠狠色综合久久| 国产一区二区三区久久精品| 人人狠狠综合久久亚洲婷婷| 久久伊人精品一区二区三区| 色综合久久久久综合体桃花网| 欧洲精品久久久av无码电影| 国产精品激情综合久久| 伊人久久大香线蕉AV一区二区| …久久精品99久久香蕉国产| 亚洲精品国精品久久99热| www久久久天天com| 婷婷久久综合| 久久性精品| 91精品久久久久久无码| 亚洲av日韩精品久久久久久a| 国产农村妇女毛片精品久久| 久久久久女人精品毛片| 久久精品国产亚洲AV香蕉| 久久涩综合| 99久久99久久精品国产| 久久久久久午夜成人影院| 狠狠精品久久久无码中文字幕 | 99精品伊人久久久大香线蕉| 无码AV中文字幕久久专区| 亚洲国产日韩欧美久久| 久久免费香蕉视频| 久久嫩草影院免费看夜色| 久久国产高清一区二区三区| 99热精品久久只有精品| 国产亚洲美女精品久久久久狼| 久久精品国产亚洲αv忘忧草 | 亚洲国产精久久久久久久| 国产精品久久久久影视不卡| 亚洲午夜久久久久久久久久| 99久久精品免费看国产一区二区三区 | 久久久久久久精品成人热色戒| 人妻中文久久久久| 久久人妻AV中文字幕| 国产成年无码久久久免费|