I`m trying to do a linked list, but it's giving me segmentation fault error.
Here`s code:
typedef struct{
  char diretor[50];
  char nome[50];
}Filme;
typedef struct{
  Filme filme;
  struct Nodo *proximoNodo;
}Nodo;
void inserirFinal(Nodo **nodo_inicial)
{
  Nodo *novo_nodo, *iterador;
 
  iterador = *nodo_inicial;
  novo_nodo = malloc(sizeof(Nodo));
  adicionarNovoFilme(novo_nodo);
  novo_nodo->proximoNodo = NULL;
  if(iterador == NULL)
    *nodo_inicial = novo_nodo;
  else
  {
    while(iterador != NULL)
      iterador = iterador->proximoNodo;
    iterador->proximoNodo = novo_nodo;
  }
}
void adicionarNovoFilme(Nodo *nodo)
{
  Filme filme;
  printf("Diretor:");
  gets(filme.diretor);
  printf("Nome:");
  gets(filme.nome);
  nodo->filme = filme;
}
The code should insert a new node at the end of a linked list (if it was empty, it started one) The method would receive a pointer to a pointer that would be the iterator of the list in the main. I'm don't know why it's giving segmentation error.
 
    