-4
#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);
}

In this code, I have a problem accessing the struct inside my struct. What should I write in this code where I have a.left, a.right? Thank you all.

reinierpost
  • 7,591
  • 1
  • 32
  • 66
Dost
  • 33
  • 7

1 Answers1

1

a is an AVL, which is a pointer to a struct avl. Thus, to access a field of that structure, you'd need something like a->left.

Scott Hunter
  • 44,196
  • 8
  • 51
  • 88