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?