title: Declare struct type, insert values into array of the type, and print out array
body: <p>In this program, I would like to define a struct called person, and an insert function for inserting an element into unused space in the array which is declared as type person. Lastly, I would like to print out the results as standard output. Could anyone give me a hint for correct anything which is wrong? Cheers</p>
  
  <p>Error: </p>
  
  <pre><code>arrays.c:16:22: error: expected ')' before '[' token
  arrays.c: In function 'main':
  arrays.c:34:5: warning: implicit declaration of function 'insert'
  arrays.c:41:5: warning: format '%s' expects type 'char *', but argument 2 has type 'char **'
  </code></pre>
  
  <p>Code</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  /* these arrays are just used to give the parameters to 'insert',
     to create the 'people' array */
  char *names[7]= {"Simon", "Suzie", "Alfred", "Chip", "John", "Tim",
            "Harriet"};
  int ages[7]= {22, 24, 106, 6, 18, 32, 24};
  
  
  /* declare your struct for a person here */
  typedef struct{
    char name;
    int ages; 
  }  person;
  
  static void insert (p[], char *name, int ages) {
  
    static int nextfreeplace = 0;
    /* put name and age into the next free place in the array parameter here */
    person p[0] = {&amp;name, age};
  
    /* modify nextfreeplace here */
    nextfreeplace++;
  
  }
  
  int main(int argc, char **argv) {
  
    /* declare the people array here */
     person p[7];
  
     //insert the members and age into the unusage array. 
    for (int i=0; i &lt; 7; i++) {
      insert (p[i], &amp;names[i], ages[i]);
      p[i]= p[i+1];
  
    }
  
    /* print the people array here*/
    for (int i=0; i &lt; 7; i++) {
      printf("%s is %d years old\n", &amp;names[i], ages[i]);
    }
  
    return 0;
  }
  </code></pre>