with this structures:

//Structure of binary tree
typedef struct nodo_ab
    int etiqueta;
    list primerapos;
    list ultimapos;
    char dato; 
    struct nodo_ab* izq;
    struct nodo_ab* der;
    struct nodo_ab* padre;
} nodo_ab;
typedef struct nodo_ab *abb;

//Structure of list
typedef struct nodo_lista{
    int dato;
    struct nodo_lista *sig;
typedef struct nodo_lista *list;

I have a problem with this line:

        (i)->primerapos.insert_list(&primerapos, contador_etiquetas);  //ERROR!

where i is abb type, primerapos is a list type, dato and contador_etiquetas are integer;

the error says: 'request for member 'insert_list' in i->nodo_ab::primerapos, which is of non-class type nodo_lista '

what can I do to insert values into the list, which is part of my bynary tree structure?

Recommended Answers

All 3 Replies

list is a typedef (an alias for) a pointer to a nodo_lista. typedef struct nodo_lista *list; If struct nodo_lista does have a member function insert_list(), then: (i)->primerapos[B]->[/B]insert_list(&primerapos, contador_etiquetas);

no, I tried it and it didn't work.

I resolved the problem by doing:

(i)->primerapos=insert_list(&primerapos, contador_etiquetas);

where insert_list() returns an pointer to list

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.