I can't figure out what function I can use to check what does a string contain as instructed that we can use a function in the docs.cs50 assignment page. Neither do I understand why this code doesn't work ?
bool check_flag(char *str)
{
if (strlen(str) == 3)
{
if (str[0] == '-' && (str[1] == 'a' || str[1] == 'b' || str[1] == 'r'
|| str[1] == 's') && str[2] == '\0')
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}