title: How to pass array from library in c
body: <p>I'm new in c programming and I want to pass array from library.
  I have function in library c file that creates char array. How to use this array in main function. This is short code of something I tried:</p>
  
  <p>libfile.c</p>
  
  <pre><code>char *myArray;
  void PopulateArray()
  {
    // Getting data from serial port in char buffer[100]
    myArray = buffer;
  } 
  </code></pre>
  
  <p>libfile.h</p>
  
  <pre><code>exter char *myArray;
  void PopulateArray();
  </code></pre>
  
  <p>program.c</p>
  
  <pre><code>int main()
  {
     // in fore loop
    printf("%s\n" , myArray[i]);
  }
  </code></pre>
  
  <p>This is just one of combinations that I have tried but nothing works.
  How to do this?</p>