What type of cast to use

Hi all!

What is the appropriate cast to use in tine 5?
1
2
3
4
5
6
7
8
9
10
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]){
	char character;
	if(strstr("aeiou", character))
		printf("is in ...\n");
	else
		printf("is not in ...\n");
	return 0;
}


Thanks
Cast? strstr searches for a string within another string, but you're passing a character.

If you want to search for a character in a string, use strchr.
So there is no way i can "disguise" a char as a one-character-string! ... this is where i was thinking wrong then.
Thanks
1
2
3
4
5
char character[2] = {0,0};

character[0] = the_character_you_want_to_use;

strstr("aeiou",character);
Topic archived. No new replies allowed.