• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 檢驗字符在字符串中的出現次數

    發表于:2007-05-26來源:作者:點擊數: 標簽:
    很牛B,效率很高。 /* Check if there are same charactors in the string.And it may be the most effective way. */ #include lt;stdio.hgt; main(int argc,char *argv[]){ puts(argv[1]); char num[256]=; /*good way to init a char array*/ unsigned ch

    很牛B,效率很高。

    /*
    Check if there are same charactors in
    the string.And it may be the most
    effective way.
    */

    #include &lt;stdio.h&gt;

    main(int argc,char *argv[]){
       puts(argv[1]);
       char num[256]=;   /*good way to init a char array*/
       unsigned char *pos = (unsigned char *)argv[1];
       while(*pos!=0&amp;&amp;num[*pos]==0){
          /*
            &quot;*pos&quot; used for checking if the string goes end.
            &quot;num[*pos]==0&quot; used for checking if the char appeared before.
          */
          num[*pos++]=1;
       }
       printf(&quot;%i\n&quot;,(*pos==0?0:1));
    }

    心得:

    *用初始化數組。

    原文轉自:http://www.kjueaiud.com

    評論列表(網友評論僅供網友表達個人看法,并不表明本站同意其觀點或證實其描述)
    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>