C error: dereferencing pointer to incomplete type again

0

Good for everyone, I'm stuck with this code ... it's something like a case that was presented previously but by making the corrections suggested in that post, I still have the same error ... please if you could help me. ..

I have these two structures

struct platos_por_pedido{
    int id_pedido;
    int item_nro;
    int id_plato;
    char observacion[30];
    char cocinero[2];
    char hora_inicio[4];
    char hora_fin[4];
    char estado[2];
    struct platos_por_pedido * ptrSiguiente;
};

typedef struct platos_por_pedido Platos_por_Pedido;
typedef Platos_por_Pedido * ptrPlatos_por_Pedido;


struct lista_platos_por_pedido{
    ptrPlatos_por_Pedido ptrCabeza;
    struct lista_platos_por_pedido * ptrSiguiente;
};

typedef struct lista_platos_por_pedido Lista_Platos_por_Pedido;
typedef struct Lista_Platos_por_Pedido * ptrLista_Platos_por_Pedido;

Then in a portion of my code I create a pointer to the structure lista_platos_por_pedido

ptrLista_Platos_por_Pedido nodoNuevoLista;

nodoNuevoLista  = malloc(sizeof(Lista_Platos_por_Pedido));

A little later I try to initialize the components

nodoNuevoLista->ptrCabeza = NULL;
nodoNuevoLista->ptrSiguiente = NULL;

And I pulled that error in the first line where I try to initialize.

This already left me on the canvas.

    
asked by Mario Ramos Lopez 13.06.2017 в 01:31
source

1 answer

0

Are you sure the error comes from the placed segments? Because I can not reproduce it.

This is the code you use:

#include <stdlib.h>

struct platos_por_pedido{
    int id_pedido;
    int item_nro;
    int id_plato;
    char observacion[30];
    char cocinero[2];
    char hora_inicio[4];
    char hora_fin[4];
    char estado[2];
    struct platos_por_pedido * ptrSiguiente;
};

typedef struct platos_por_pedido Platos_por_Pedido;
typedef Platos_por_Pedido * ptrPlatos_por_Pedido;



struct lista_platos_por_pedido{
    struct platos_por_pedido * ptrCabeza;
    struct lista_platos_por_pedido * ptrSiguiente;
};

typedef struct lista_platos_por_pedido Lista_Platos_por_Pedido;
typedef struct Lista_Platos_por_Pedido * ptrLista_Platos_por_Pedido;




int main(int argc, char const *argv[]) {
    struct lista_platos_por_pedido * nodoNuevoLista;
    nodoNuevoLista  = malloc(sizeof(struct lista_platos_por_pedido));

    nodoNuevoLista->ptrCabeza = NULL;
    nodoNuevoLista->ptrSiguiente = NULL;

    return 0;
}
    
answered by 13.06.2017 / 01:52
source