title: Linked list of chars in C
body: <p>I'm trying to create a <strong>linked list holding char type data.</strong> </p>
  
  <p>For some reason, the code does not work. The GCC compiler's warning for function "add_bottom_ListEl" is </p>
  
  <p>"warning: passing argument 2 of 'add_bottom_listEl' makes integer from pointer without a cast" </p>
  
  <p>and </p>
  
  <p>"note: expected 'char' but argument is of type 'char * "</p>
  
  <p>I suspect that there's something wrong about the way I use pointers, but I've tried many, many combinations, passing pointers to the function etc... But nothing seemed to work.</p>
  
  <p>Here's main function and all the others used. MAX_CHAR is defined in all files (#define MAX_CHAR 30)</p>
  
  <pre><code>int main()
  {
      char name[MAX_CHAR];
      scanf("%s", name);
      ListEl *head = malloc(sizeof(ListEl));
      strcpy(head-&gt;name, name);
      head-&gt;next = NULL;
      printf("%s", head-&gt;name);
      add_bottom_listEl(head, name);
      print_listEl(head);
      return 0;
  }
  void add_bottom_listEl (ListEl *head, char name)
  {
      ListEl *newEl;
      while(head-&gt;next!=NULL)
      {
          head=head-&gt;next;
      }
      newEl = (ListEl*) malloc(sizeof(ListEl));
      strcpy(newEl-&gt;name, name);
      newEl-&gt;next = NULL;
  }
  void print_listEl(ListEl* head)
  {
      puts("print");
      ListEl* current = head;
      while (current!=NULL)
      {
          int i=1;
          printf("%d.%s\n", i, current-&gt;name);
          ++i;
          current = current -&gt; next;
      }
  }
  </code></pre>
  
  <p>The ListEl structure is just a regular element of a linked list</p>
  
  <pre><code>struct ListEl
  {
      char name[MAX_CHAR];
      struct ListEl* next;
  };
  </code></pre>
  
  <p>Obviously, I used </p>
  
  <pre><code>typedef struct ListEl ListEl;
  </code></pre>
  
  <p>Every linked list tutorial on the internet or this site is only showing how to handle lists with integers or numbers in general, but not arrays (chars). Can anyone help me out here?</p>