title: A function that returns a table of struct in C
body: <p>I have a struct call Client , and a function <code>initClient</code> that create such struct.</p>
  
  <p>Now I want to implement a function that creates a <code>table[20000]</code> of this struct, but I couldn't figure out the right syntax of the returned data. Is it <code>Client**</code> or <code>Client[]</code> ?...
  This is my code: <code>client.h</code>:</p>
  
  <pre><code> struct sClient
   {
       int num_tel;
       int nbr_appel;
       int cout;
    };
  
    typedef struct sClient Client;
    Client * initClient(int num_tel, int nbr_appel,int cout);
    Client *createData();
  </code></pre>
  
  <p>and main.c:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include "client.h"
  
  Client* initClient(int num_tel, int nbr_appel,int cout){
      Client *c = (Client *) malloc(sizeof(Client)); 
      c-&gt; num_tel =num_tel;
      c-&gt; nbr_appel= nbr_appel; 
      c-&gt; cout= cout;
  
      return c; 
  }
  
  Client* createData(){
      // Number of clients
      #define NBCLIENT 20 
      Client* tab[NBCLIENT];
      Client *c; 
      int i,numeroTel,prixAppel;
  
      for(i=0;i&lt;NBCLIENT;i++)
      {
          // Generation of a random num_tel
          numeroTel = 600000000+(rand() % NBCLIENT);   
          prixAppel = (rand() % 400)+1; 
          c=initClient(numeroTel,1,prixAppel);
          tab[i]=c;      
      }   
      return tab;    
  }
  
  int main(int argc, char *argv[])
  {
      createData();
      system("PAUSE");    
      return 0;
  }
  </code></pre>