#define LEFT 1
#define BAL 0
#define RIGHT -1
typedef struct avl {
int value;
int bal;
struct avl *left, *right;
} *AVL;
AVL lower (AVL a){
while ((a.left != NULL) || (a.right != NULL)) {
if (a.bal = LEFT){
AVL lower (a.left);
} else AVL lower (a.right);
}
return (a);
}
在这段代码中,我在访问
struct
内部的struct
时遇到问题。在具有
a.left
,a.right
的地方,该代码应该写什么?谢谢你们。 最佳答案
a
是AVL
,它是指向struct avl
的指针。因此,要访问该结构的字段,您需要类似a->left
的内容。
关于c - AVL树,结构中的访问指针,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41854313/