strrchr used to find the last location of char in c
/*strrchr is string character found last time in the function
strchr is used to find the character found first time in the function */
#include <stdio.h>
#include <string.h>
int main()
{ char c [] = "rohitparmar";
char *p;
p = strrchr(c , 'r');
if(p == NULL){
printf("character is not found in the string\n");
}else{
printf("character is %c last at location %p\n", *p , p );
}
return 0;
}
Comments
Post a Comment