How do I fill a multilist?

0

I have a list linked to another list in this way:

struct lista {  
    int valor;  
    lista *prox;  
}  

struct multi {  
    int valor;  
    multi *prox;  
    lista *abajo;  
};  

void insertarcabmulti(multi **cab, int x) {  
    multi *t = new multi;  
    t->valor = x;  
    t->prox = *cab;  
    *cab = t;  
}  

int main() {  
    int op = -1, x = 0, y = 0;  
    multi *p = NULL;  
    while (op) {  
        system("cls");  
        printf("\n\n\t\tMENU DE MANEJO DE MULTILISTAS \n ");  
        printf("1.\tInsertar por comienzo de lista\n ");  
switch (op) {  
        case 1: printf("\nIndique dato a insertar\n");  
            scanf_s("%i", &x);  
            insertarcabmulti(&p, x);  
            break;  
}  
        system("pause");  
    };   
}   

But I have no idea how to fill both lists, whatever I do I always fill everything that corresponds to "multi" but I have no idea how to fill "list", can someone help me? My biggest problem is accessing the "list" information, I have no idea how to do it, should it be (pointer to multi->abajo->valor )? Or how?

    
asked by EternalGrey 24.05.2018 в 17:31
source

1 answer

1

It is hard to understand your problem without describing what you understand by " multilista ". By the code I can deduce that it is a list of lists. If so, you are committing the most common mistake of the tag

answered by 25.05.2018 в 08:38