12. Write a function that finds the last instance of a character in a string


12. Write a function that finds the last instance of a character in a string

char *lastchar(char *String, char ch)
{
 char *pStr = NULL;      // traverse the entire string      while( * String ++ != NULL ) 
{
 if( *String == ch ) 
    pStr = String;
                                }      
return pStr;


Disqus Comments