well I've got this code that I'm trying to get working but no matter what I keep on getting that I am getting 0xC0000005
int main()
{
if(stringContains("hello", "Hello world", FLAG_CASE_SENSITIVE))
{
printf("Works");
}
printf("%i", stringContains("hello", "Hello world", FLAG_CASE_SENSITIVE));
return 0;
}
#define FLAG_CASE_INSENSITIVE 0
#define FLAG_CASE_SENSITIVE 1
typedef enum { false, true } bool;
bool stringContains(char* needle, char* stack, int type);
char* toLower(char* s);
bool stringContains(char* needle, char* stack, int type)
{
if(type == FLAG_CASE_SENSITIVE)
{
return (strstr(toLower(stack), toLower(needle)) != 0) ? true : false;
}
return (strstr(stack, needle) != 0) ? true : false;
}
char* toLower(char* s) {
for(char *p=s; *p; p++) *p=tolower(*p);
return s;
}
I must admit, I am pretty basic when it comes to C