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

            Feedback

            # re: How to express string synatic effectively(1)? 2007-04-19 03:49 天津大學(xué)計算機學(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

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            国产福利电影一区二区三区,免费久久久久久久精 | 72种姿势欧美久久久久大黄蕉| 久久精品国产99久久久香蕉| 99热精品久久只有精品| 久久久91人妻无码精品蜜桃HD| 中文字幕久久精品无码| 热久久国产精品| 精品综合久久久久久97| 久久99国产精品二区不卡| 区亚洲欧美一级久久精品亚洲精品成人网久久久久 | 色综合久久中文字幕无码| 美女写真久久影院| 狼狼综合久久久久综合网| 久久久久亚洲?V成人无码| 欧美亚洲色综久久精品国产| 色诱久久av| 99久久精品国产毛片| 久久久久亚洲AV无码麻豆| 婷婷久久综合| 久久福利片| 久久亚洲精品视频| 精品蜜臀久久久久99网站| 伊人色综合久久天天人手人婷| 久久精品国产色蜜蜜麻豆| www.久久热| 久久天天躁狠狠躁夜夜网站| 狠狠色丁香婷婷久久综合五月| 久久精品视频91| 久久97久久97精品免视看| 国产精品久久亚洲不卡动漫| 人妻精品久久久久中文字幕69| 久久久亚洲裙底偷窥综合| 亚洲а∨天堂久久精品9966| 久久综合九色综合欧美就去吻| 国产精品99久久久久久www| 久久亚洲国产中v天仙www| 欧美综合天天夜夜久久| 青青青国产成人久久111网站| 亚洲精品高清久久| 久久黄视频| 一级a性色生活片久久无|