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?

5 Years
Discussion Span
Last Post by montjoile
Featured Replies
  • 1

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


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);


I resolved the problem by doing:

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

where insert_list() returns an pointer to list

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.