C/C++怎样通过一个结构体访问另一个结构体的数据?
struct Student{
char school[20];
char name[20];
};
struct BstNode
{
Student stu;
BstNode* left;
BstNode* right;
}; //定义二叉树
void isEqual(BstNode **root, Student argu){ //此处传入root的地址
if(strcmp(argu->name,(*root)->stu->name)<0)
//do something...
}
我想判断比较argu的name和当前节点下所包含的stu的name的大小,但是argu->name,(*root)->stu->name报错: base operand of '->' has non-pointer type 'Student' 我应该怎么做呢?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

argu.name, (**root).stu.name