Disclaimer: I'm a newbie. I was trying out conditional chains in C with a simple quiz.
I entered this:
int age = get_int("Age in whole numbers: ");
int r;
if(age<12)
{
printf("Go back kid\n");
r = 0;
}
else if(12<= age <16)
{
printf("Teenagers not allowed\n");
r = 0;
}
(im using cs50 codespace in visualstudio which has aforementioned get_int function)
age<12 worked but problem showed with this line
else if(12<= age <16)
The error mentioned in title: Error
My main question is the "why" and not just the "how" - as in how does this result in a "Boolean expression" in this case?? I just want to check if age is greater than or equal to 12, and less than 16. The age variable is declared int and will store an int and not Boolean as per my current understanding. How else do I compare the variable input?