In C programming the <string.h> strchr function search for a specific character in a string.The declaration of the function us given below.
|char *strchr(const char *s, int c);|
s -The string from which the character is to be searched for.
c -The character which is to be searched for in ‘s’ pointed string.
char* -Returns a pointer to the located character,or a null pointer if the character does not occur in the string.
This function is similar to ‘memchr’ function which also search for a particular character in a string.
c = ‘ ‘;
printf(“s=%s” , s );
//searches for ‘ ‘(space) and replaced it with ‘_'(underscore)
while( (retCh=strchr(s , c))!=NULL )
printf(“s=%s” , s);
s=Core C plus plus tutorial