Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int is_within(char ch, char string[]);
- int main(void){
- printf("The number is %d.\n", is_within('h', "hello"));
- return 0;
- }
- int is_within(char ch, char string[]){
- int instring=0; //false
- unsigned long length=strlen(string);
- unsigned long count=0;
- char *ptr=string;
- while(count!=length){
- if(*ptr==string[count])
- instring=1;//true
- break;
- ptr++;
- count++;
- }
- return instring;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement