I am trying to create a struct that has 2 pointers of type struct nodo defined above the code. But it gives me the error:
expected ':', ',', ';', '}' or 'attribute' before '=' token lista dati_mappa=NULL;".
Here is the code:
typedef int data;
struct nodo
{
data elem;
struct nodo *next;
};
typedef struct nodo *lista;
struct mappa {
data R;
data C;
lista dati_mappa = NULL;
lista pos_valida = NULL;
};
struct nodo, then you need to use thesizeofoperator to get the size of the structure. If you hide the structure behind a type-alias one commonly use that type-alias as the argument to thesizeofoperator. And if that type-alias is a pointer, then you allocate the size of a pointer, and not the whole structure.sizeof(struct nodo) != sizeof(lista). Such errors are unfortunately very easy to do.