Salve,
vi copio subito il codice che mi da problemi:
La compilazione non mi da problemi.codice:int main(int argc, char *argv[]) { typedef struct edge { int key; } edge; typedef struct graph { edge **adj; } graph; graph *array; int i; array = (graph *)malloc(sizeof(graph)); array->adj = (edge **)malloc(5*sizeof(edge *)); for (i=0; i<5; i++) array->adj[i]->key = i; return 0; }
Però, in esecuzione, quando arriva ad eseguire l'istruzione array->adj[i]->key = i; mi da errore di "Segmentation fault".
Qualcuno mi sa aiutare?
Grazie.