http://www./C_Function/2007-06-13/c_5917.html 函數(shù)名: strrchr 功 能: 在串中查找指定字符的最后一個出現(xiàn) 用 法: 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; } |
|
來自: langhuayipian > 《c 語言與gcc》