OK, I figured it out. Here's how you do it in C.<br><br> #define strchr(p,c) (p + istrchr(p,c))<br> <br> int istrchr(const char * p, char c)<br> {<br> int i;<br> for (i=0; p[i]; ++i)<br> {<br> if (p[i] == c) return i;
<br> }<br> return (const char *)0 - p;<br> }<br><br><br>As required, the parameter is const at the callee site, but the output is the same type as the input at the caller site.<br><br><br>