title: Linked list to contain strings in c
body: <pre><code>struct node
  {
      char *IPArray[100];
      struct node *ptr;
  };
  typedef struct node NODE;
  
  NODE *head, *first, *temp = 0;
  
  first = 0;
  
  int numofIP;
  </code></pre>
  
  <p>This is my structure to contain string at every node in a linked list. And numofIP is maximum number of strings or nodes in my linked list.</p>
  
  <pre><code>for(int i=0; i&lt;numofIP; i++)
  {
      head  = (NODE *)malloc(sizeof(NODE));
      printf("enter the IP addresses:\n");
      scanf("%s",&amp;head-&gt;IPArray[i]);
  
      if(first != 0)
      {
          temp-&gt;ptr = head;
          temp = head;
      }
      else
      {
          first = temp = head;
      }
  }
  
  temp-&gt;ptr = 0;
  temp  = first;
  </code></pre>
  
  <p>this is how I accept input and store it in every node.</p>
  
  <pre><code>while(temp != NULL)
  {
      printf("%d=&gt; ",temp-&gt;IPArray);
      temp = temp-&gt;ptr;
  }
  </code></pre>
  
  <p>And this is how I print the linked list.</p>
  
  <p>But problem is I get addresses in output. I am not able to figure it out.  How to store a string in each node in a linked list?</p>