title: Using For to create struct to initialize
body: <p>Hi I have a problem I'm trying to initialize an hashtable with an array that contains list but when I'm using a <strong>for</strong> loop, all the data are "shared". I've to initialize mannualy like that :</p>
  
  <pre><code>   struct objec_listt A,B; // Initialization of 2 two structure A and B
     INIT_LIST_HEAD(&amp;A.list); // A is headlist
     INIT_LIST_HEAD(&amp;B.list); // B is headlist
     hashtable-&gt;tab[0]= &amp;A; // I insert A into the array
     hashtable-&gt;tab[1]= &amp;B; // I insert B into the array
  
     insert(1,tab[0]); //  insert 1, not real syntax 
     insert(2,tab[0]); //  insert 2
     insert(3,tab[1]); //  insert 3
  </code></pre>
  
  <p>Now I print tab[0] and tab[1] with my own function and I get</p>
  
  <p>tab[0] = 1,2 </p>
  
  <p>tab[2]= 3</p>
  
  <p>Ok it works as I want</p>
  
  <p><strong>If I do like that It doesnt work :</strong></p>
  
  <pre><code>   for(i=0; i&lt;2; i++)
     {
       struct objec_listt A;
       INIT_LIST_HEAD(&amp;A.list);
       hashtable-&gt;tab[i] = &amp;A
     }
  
     insert(1,tab[0]); //  insert 1,
     insert(2,tab[0]); //  insert 2
     insert(3,tab[1]); //  insert 3
  </code></pre>
  
  <p>If I do a 
  printf :</p>
  
  <p>tab[0] : 1,2,3</p>
  
  <p>tab[1] : 1,2,3</p>
  
  <p>So the problem is like I'm trying to create "many object" that will be head of list, and for each 
  I need to initialize an array with a size of 100, so that why I'm looking to do with loop</p>
  
  <p>Thanks !</p>