title: How to initialize a Linked List with a struct with many variables
body: <p>I still have troubles with the relations between the linked lists and the structures.</p>
  
  <p>See, my objectif is to create a list where each node contains 2 characters strings. So, I tried something like this : first, I create a structure that represent an element with my 2 char ; second, a control structure for my list, thath will point at the beginning of my list. Which, in my .h, gives something like this : </p>
  
  <pre><code>typedef struct s_def { char *first_word; char *second_word; struct s-def *next; }  t_def
  
  typedef struct s_type { t_def *first; } t_list;
  </code></pre>
  
  <p>Next, I try to initialize my list. I make a function that work like this : </p>
  
  <pre><code>t_list *list;
  t_def *words;
  
  list = malloc(sizeof(*list));
  words = malloc(sizeof(*words));
  if (list == 0 || words == 0)
     return (NULL);
  words = NULL;
  words-&gt;next = NULL;
  list-&gt;first = words;
  
  return (list);
  </code></pre>
  
  <p>Precision : I try to make an empty list for now, so that the user can add some elements later.</p>
  
  <p>And that's where it block : when I run the program, it gives the typical Segmentation Fault. But it don't see what's wrong with what I made ! I put some write in my function to retrace the process : the malloc are working ok, as well as the words = NULL, but then the segment fault seems to run at the line </p>
  
  <pre><code>words-&gt;next = NULL;
  </code></pre>
  
  <p>What do I make wrong ? Why can't I give a NULL value at the next of my words ?</p>