while (temp->left->oper == '+' ||
temp->left->oper == '-' ||
temp->left->oper == '*' ||
temp->left->oper == '/' ||
temp->right->oper == '+' ||
temp->right->oper == '-' ||
temp->right->oper == '*' ||
temp->right->oper == '/')
{
// do something
}
为了更清晰: temp
是一个指向以下node
结构的指针:
struct node
{
int num;
char oper;
node* left;
node* right;
};
temp->left
和temp->right
之间的依赖关系。从视觉上看,你可以使用正则表达式,但在内部实现上可能是相当或甚至更加低效的。 - U. Windl