• <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 天津大學(xué)計算機(jī)學(xué)院 常興龍

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



            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            My Links

            Blog Stats

            News

            常用鏈接

            留言簿(1)

            隨筆分類(13)

            隨筆檔案(17)

            文章檔案(1)

            相冊

            收藏夾(1)

            Friends' blog

            useful sites

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            99久久精品免费国产大片| 人妻精品久久无码专区精东影业| 精品亚洲综合久久中文字幕| 久久综合久久久| 久久香蕉综合色一综合色88| 亚洲国产精久久久久久久| 久久久久久一区国产精品| 思思久久99热只有频精品66| 久久无码人妻一区二区三区| 91久久成人免费| 无码人妻久久一区二区三区蜜桃 | 国产精品久久亚洲不卡动漫| Xx性欧美肥妇精品久久久久久 | 久久精品无码一区二区三区日韩| 老男人久久青草av高清| 亚洲精品国产成人99久久| 99精品久久久久久久婷婷| 93精91精品国产综合久久香蕉| 久久精品aⅴ无码中文字字幕不卡| 狠狠色婷婷综合天天久久丁香| 久久无码高潮喷水| 久久不见久久见免费影院www日本| 亚洲va中文字幕无码久久| 日本加勒比久久精品| 日韩欧美亚洲综合久久影院d3| 亚洲精品白浆高清久久久久久 | 久久精品人妻中文系列| 久久免费99精品国产自在现线| 久久精品国产亚洲AV大全| 中文字幕精品无码久久久久久3D日动漫 | 亚洲国产精品无码久久一线| 久久午夜综合久久| 久久精品亚洲乱码伦伦中文| 国产精品99久久久久久www| 国产精品久久久久9999| 国产精品久久久久jk制服| 久久精品国产久精国产思思| 久久久无码一区二区三区| 久久狠狠高潮亚洲精品| 久久久久亚洲精品无码蜜桃| 人妻精品久久无码区|