You are here : Cstring.hstrchr

strchr() - string.h

The C library function char *strchr(const char *str, int c) searches for the first occurrence of the character c (an unsigned char) in the string pointed to by the argument str.


Syntax

char *strchr(const char *str, int c)


Example

#include <stdio.h>
#include <string.h>

int main ()
{
   const char str[] = "http://www.tutorialspoint.com";
   const char ch = '.';
   char *ret;

   ret = strchr(str, ch);

   printf("String after |%c| is - |%s|\n", ch, ret);
   
   return(0);
}


Output / Return Value

String after |.| is - |.tutorialspoint.com|


Limitations


Alternatives / See Also


Reference