title: C: Pointer to pointer issue when I try to group a lot of things in it
body: <p>I have a function that adds one item to a list that I created. If it's the first time and the list points to <code>NULL</code>, it allocates the list and completes it, returning the address. If it's not the first time, it adds another item and again returns the first item (by now I could disregard this return). The list and the function WORKS fine, here is the prototype:</p>
  
  <pre><code>typedef struct structTAppConsoleList {
      char *text;
      void (*cbFunction)(int);
      int number; // This is the item number
      struct structTAppConsoleList *previous;
      struct structTAppConsoleList *next;
  } TList;
  
  TList *AppConsoleListAddItem(TList *p_list, const char *p_string, void (*p_funcPtr)(int));
  </code></pre>
  
  <p>So, somewhere in my code I have to create a lot of them and I'm trying to make it as the code below shows. Thing is, I can't make it work... I want to create something to group the lists I want to create and then use it in the function. The code below is an idea of what I'm trying to do. Consider only the part where I try to allocate the 3 lists, the rest is not important for this example.</p>
  
  <pre><code>TList *list1;
  TList *list2;
  TList *list3;
  
  int main(void)
  {
      int i,j;
      TList **groupMyLists;
      TList *temp;
  
      groupMyLists=malloc(sizeof(TList)*3);
  
      *groupMyLists    =(TList*)&amp;list1;
      *(groupMyLists+1)=(TList*)&amp;list2;
      *(groupMyLists+2)=(TList*)&amp;list3;
  
      for(j=0;j&lt;3;j++) {
          temp=NULL;
          for(i=0;i&lt;10;i++) {
              temp=AppConsoleListAddItem(temp,"some text",someFunc);
          }
          **groupMyLists=temp; // my make won't let me do this
          groupMyLists++;
      }
  }
  </code></pre>
  
  <p>I'm pretty sure that this would do it, but I can't compile it.</p>
  
  <p>In my head, <code>(*groupMyLists)</code> would be the same as <code>(&amp;list1)</code>, <code>(&amp;list2)</code>, <code>(&amp;list3)</code>, the same way that <code>(**groupMyLists)</code> would be the same as <code>(list1)</code>, <code>(list2)</code> and <code>(list3)</code>. So why I can't do <code>(**groupMyLists=temp)</code>? Anyone?</p>
  
  <p>I hope I made myself clear!! I's not easy to explain this madness I'm trying to do...</p>