This is not so much a coding question but a syntax question for C. Consider this simple function that checks whether a user input character is a number or operator, assuming that the user only inputs either numbers or operator symbols:
int isnumber(char c)
{
if ((c == '+') || (c == '-') || (c == '*') || (c == '/') || (c == '(') || (c == ')'))
{
return 0;
}
return 1;
}
Very frequently, I find myself needing to do boolean checks like this for whatever reason, and I find it a pain to write (c == something) separated by boolean operators everytime. So I was wondering if there was an easier, shorter version to write something like this in the syntax for C Programming?