strchr () is a predefined string function, very much used in C Language programming. that takes two arguments-the first is a character array and the second is a single character.This function searches the character in the string and if found returns the memory address of the character in the string , where it is found for the first time otherwise the function will return NULL
.
#include< stdio.h >
#include< string.h >
void main ()
{
int i;
char name [100],ch;
clrscr();
puts("Enter the string:-");
gets(name);
puts("Enter the character:-");
scanf("%c",&ch);
if(strchr(name,ch)!=NULL)
printf("The character is found.");
else
printf("Not found.");
getch();
}
No comments:
Post a Comment