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

            寫得不錯(cuò),可以發(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

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            国产午夜精品久久久久免费视| 久久午夜无码鲁丝片秋霞 | 国产成人AV综合久久| 久久国产成人精品麻豆| 93精91精品国产综合久久香蕉| 久久WWW免费人成—看片| 久久亚洲精品无码aⅴ大香| 狠狠狠色丁香婷婷综合久久五月| 国内精品欧美久久精品| 亚洲乱码精品久久久久..| 大香网伊人久久综合网2020| 国产亚洲美女精品久久久2020| 精品一区二区久久| 97精品依人久久久大香线蕉97| 欧美激情精品久久久久| 一本久久a久久精品亚洲| 日本亚洲色大成网站WWW久久| 久久久久亚洲AV无码麻豆| 武侠古典久久婷婷狼人伊人| 国产精品九九久久免费视频| 久久精品亚洲福利| 国产色综合久久无码有码| 人妻系列无码专区久久五月天| 97久久精品无码一区二区| 日本WV一本一道久久香蕉| 久久久久国产一区二区三区| 国产一区二区精品久久| 久久亚洲国产成人精品性色| 久久精品国产亚洲av麻豆蜜芽 | 久久亚洲AV成人无码国产| 模特私拍国产精品久久| 精品久久久久久久久久中文字幕| 99久久婷婷免费国产综合精品| 婷婷五月深深久久精品| 欧美日韩精品久久久久| 久久婷婷午色综合夜啪| 亚洲欧美精品一区久久中文字幕| 久久国产视频网| 久久久久99精品成人片牛牛影视 | 色综合久久夜色精品国产| 老司机午夜网站国内精品久久久久久久久|