3.1. strchr
char *strchr( const char *s, int c);strchr returns a pointer to first occurrence of c in s or NULL if not present.
The terminating '\0' of s is considered to be part of the string.
For example, to replace all the '/' characters in a string str with '\\':
char *p;
while( (p = strchr( str, '/')) != NULL)
*p = '\\';
We could improve the efficiency of the above by having strchr start its
search for the next match at the position of the current match, i.e.
char *p = str;
while( (p = strchr( p, '/')) != NULL)
*p = '\\';
Since strchr considers the terminating '\0' to be part of the string,
it can be used to compute the string length:
len = strchr( str, '\0') - str;