Tuesday, 11 December 2012

Implement strrchr

* This program will search for the occurance of a character
* from the last of the string.
* If found it will return the address of last occurance of that character
* */
char *mystrrchr(const char *s1, int x)
const char *p = NULL; /*For copying the address of the string for check*/
while(*s1 != '\0'){
if(*s1 == x)
p = s1;
return(char *)p;

No comments:

Post a Comment