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

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

  • <strong id="5koa6"></strong>
  • 看不懂strrchr(),請幫忙。

    發表于:2007-05-26來源:作者:點擊數: 標簽:
    Find the first occurrence of a character in a string #include stdio.h #include stdlib.h #include string.h int main( void ) { printf( %s\n, strrchr( /usr/include, '/' ) ); if( strrchr( abcdeabcde, 'x' ) == NULL ) printf( NULL\n ); return EX

    Find the first oclearcase/" target="_blank" >ccurrence of a character in a string

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    int main( void )
      {
        printf( "%s\n", strrchr( "/usr/include", '/' ) );
        if( strrchr( "abcdeabcde", 'x' ) == NULL )
          printf( "NULL\n" );
        return EXIT_SUCCESS;
      }
    /forum/c/app.tmp# ./a.out
    /include
    NULL
    /forum/c/app.tmp#

    strrchr(const char * s,int c)返回一個char*,指向最后一次出現的c,如果s中沒有c,則返回NULL
    "/usr/include", '/'

    這里只要求找出/

    結果是卻是;/include
    函數名: strrchr
    功  能
    :
    在串中查找指定字符的最后一個出現
    用  法
    : char *strrchr(char *str, char c
    );
    程序例
    :

    #include <string.h>
    #include <stdio.h>

    int main(void
    )
    {
       
    char string[15
    ];
       
    char *ptr, c = 'r'
    ;

       
    strcpy(string, "This is a string"
    );
       
    ptr = strrchr(string, c
    );
       if (
    ptr
    )
          
    printf("The character %c is at position: %d\n", c, ptr-string
    );
       else
          
    printf("The character was not found\n"
    );
       return
    0
    ;
    }

    從一個字符串中反向查找第一個出現指定字符的位置。在正常情況下,應該是從用面開始找,出現的第一個指定字符的位置,如果是希伯來文的話,可能是從左面找的。
    Find the first occurrence of a character in a string
    謝謝??!這個注釋沒有說明白哦。??磥砭幷弑磉_得不清楚。

    原文轉自: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>