Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Iam getting an error that I don\'t understand. What do I needto do to correct th

ID: 3610512 • Letter: I

Question

Iam getting an error that I don't understand. What do I needto do to correct this problem and why am I getting thiserror?




aatree.c: In function`lookup':
aatree.c:30: error: dereferencing pointer to incompletetype
aatree.c:30: error: dereferencing pointer to incomplete type
aatree.c:36: error: dereferencing pointer to incomplete type
aatree.c:36: error: dereferencing pointer to incompletetype


#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "aatree.h"
#include "phonebook.h"
#include <string.h>
#define GROWTH_FACTOR 2

struct aatree
{
    int level;
    struct pbentry *info;
    struct aatree *left;
    struct aatree *right;
};

// bottom is defined here so that it is an alias for NULL typed asa aatree node pointer. Alternatively, it could
// be defined with a sentinel node instead of NULL

struct aatree * const bottom = NULL;

//pbentry pointer holding name and number passed in as parameter tocompare to root pointer's info
int lookup(struct aatree *root,struct pbentry *info)
{
    if(root == bottom)
    {
        //reached the bottom notfound
        return 0;
    }
    elseif(strcmp(info->name,root->info->name) == 0)
    {
        //found it
       
        return 1;
    }
    elseif(strcmp(info->name,root->info->name) < 0)
    {
        //check the left subtree
        return lookup(root->left,info);
    }
    else
    {
        //key > root->key, socheck the right subtree
        return lookup(root->right,info);
    }
}


Explanation / Answer

also, struct pbentry looks like this: struct pbentry {    char *name;    char *number; }; it is contained in phonebook.h

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote