#include<stdio.h>
#include<string.h>
#include<conio.h>
char *my_strchr(char *string,char charecter);
int main()
{
char str[20];
char ch;
char *dest;
printf("enter any string:");
gets(str);
printf("enter an charecter to search in the string:");
scanf("%c",&ch);
dest=my_strchr(str,ch);
if(dest==NULL)
printf("\nvirus");
else
printf("\nno virus");
getch();
return 0;
}
char *my_strchr(char *string,char charecter)
{
while(*string!='\0' && *string!=charecter)
{
string++;
}
if(string==NULL)
return(NULL);
else
return(string);
}
#include<string.h>
#include<conio.h>
char *my_strchr(char *string,char charecter);
int main()
{
char str[20];
char ch;
char *dest;
printf("enter any string:");
gets(str);
printf("enter an charecter to search in the string:");
scanf("%c",&ch);
dest=my_strchr(str,ch);
if(dest==NULL)
printf("\nvirus");
else
printf("\nno virus");
getch();
return 0;
}
char *my_strchr(char *string,char charecter)
{
while(*string!='\0' && *string!=charecter)
{
string++;
}
if(string==NULL)
return(NULL);
else
return(string);
}
No comments:
Post a Comment