Is there any function which can help me do the following in an efficient way?
char ch = '+';
if (( ch == '+') || (ch == '-') || (ch == '*'))
{
//do something
}
Since have to check this several times in my code, I would prefer if there was any to do it similar to
char arr ={'+','-','*'};
if (ch in arr)
{
//do something
}
Aucun commentaire:
Enregistrer un commentaire