C Programming
Computer Programming

C program to searches the occurrence of a specified character using strchr() function



Write a program in C to searches the occurrence of a specified character in the given string using strchr() function

\* C program to searches the occurrence of a specified character using strchr() function *\

# include < stdio.h >
# include < string.h >
int   main( )
{

char str[100] ;
char ch ;
char *p ;
printf ("\n Enter a string : " ) ;
scanf("%s", str ) ;
printf("\n Enter a Characher for Search : " ) ;
scanf("%s", &ch ) ;
p = strchr(str, ch ) ;
printf("\n String starting from %c is: %s", ch, p) ;
return 0 ;

}

Output of Program :

Output of C program to searches the occurrence of a specified character using strchr() function