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

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            久久国产精品一区二区| 久久精品无码一区二区WWW| 国产91色综合久久免费分享| 蜜桃麻豆www久久| 香蕉久久久久久狠狠色| 日韩精品久久久肉伦网站| 中文精品久久久久国产网址| 人妻系列无码专区久久五月天| 久久婷婷国产剧情内射白浆| 狠狠色丁香婷婷综合久久来| 一级做a爰片久久毛片看看| 91久久婷婷国产综合精品青草| 亚洲成av人片不卡无码久久| 无码精品久久久天天影视| 久久艹国产| …久久精品99久久香蕉国产| 少妇久久久久久被弄到高潮| 韩国无遮挡三级久久| 影音先锋女人AV鲁色资源网久久| 99久久免费国产精品| 99国产精品久久| 无码人妻久久久一区二区三区| 久久强奷乱码老熟女| 久久综合九色综合精品| 日产精品久久久久久久性色| 香蕉99久久国产综合精品宅男自 | 久久久一本精品99久久精品66 | 久久精品中文騷妇女内射| 午夜视频久久久久一区 | 性色欲网站人妻丰满中文久久不卡| 久久精品99无色码中文字幕| 久久精品国产一区二区三区日韩| 久久免费的精品国产V∧| 久久AV无码精品人妻糸列| 久久精品综合网| 香蕉久久夜色精品升级完成| 2020国产成人久久精品| 久久天天躁狠狠躁夜夜avapp| 久久中文字幕人妻熟av女| 一本久久a久久精品亚洲| 三上悠亚久久精品|