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;
    }nodo_lista;
typedef struct nodo_lista *list;

I have a problem with this line:

i=(nodo_ab*)malloc(sizeof(nodo_ab));
        (i)->dato=dato; 
        (*r)->izq=NULL;
        (i)->izq=NULL;
        (i)->der=NULL;
        (i)->etiqueta=contador_etiquetas;
        (i)->primerapos.insert_list(&primerapos, contador_etiquetas);  //ERROR!
        (i)->ultimapos=contador_etiquetas;
        (i)->padre=NULL;

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?

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 article has been dead for over six months. Start a new discussion instead.