title: Strcmp gives segmentation Fault
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  typedef struct station 
  {
      char * name;
      struct station * destinations;
      struct station * next;
  } station;
  struct station * findStation(station * stations, char * name)
  {
      if(stations = NULL)
      {
          printf("ERROR");
          return NULL;
      }
      else
      {
          station * temp;
          for(temp = station; temp-&gt;next != NULL; temp = temp-&gt;next)
          {
              if(strcmp(temp-&gt;name, name) == 0)
              {
                  return temp;
              }
          }
      return NULL;  
      }
  }
  void addStation(station ** stations, char * name)
  {
      if(findStation(*stations, name) == NULL)
      {
          station * newstation;
          char name1[32];
          strcpy(name1, name);
          newstation = (station *)malloc(sizeof(station));
          newstation-&gt;name = &amp;name1[0];
          if(*stations = NULL)
          {
              *stations = newstation;
          }
          else
          {
              newstation-&gt;next = *stations;
              *stations = newstation;
          }
      }
      else
      {
          printf("Station %s already exists.", name);
      }
  }
  void main(void)
  {
      station * stations = NULL;
      stations = (station *)malloc(sizeof(station));
      char name[32], ch;
      strcpy(name, "Eindhoven");
      int h = 1;
      while(h == 1)
      {
          printf("Command (s/d/p/r/f/q): ");
          scanf(" %c", &amp;ch);
          switch(ch)
          {
              case 's':
                  printf("Station: ");
                  scanf("%s", name);
                  addStation(&amp;stations, &amp;name[0]);
                  break;
              case 'q':
                  h = 0;
                  break;
              case 'p':
  
                  break;
          }
      }
  }
  </code></pre>
  
  <p>I need to write a program for school that makes a linked list of train stations and it's destinations. This piece of code gives me Segmentation Fault at "if(strcmp(temp->name, name) == 0)" (Line 23). I've been trying to fix this for like 5 hours but nothing works :(. Does anybody knows what's wrong?</p>