C语言函数—strrev

函数名

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: %dn", c, ptr-string); 
   else 
      printf("The character was not foundn"); 
   return 0; 
} 
  
  
  

如果引用本站的原创文章,请注明原文链接:,本站保留追究责任的权利!