Q:

Array of Pointer to Struct

I am a noob to C.I wrote a program that my array people is now an array of pointers to structs.  And insert to call malloc to create a new struct and set the correct array element pointing to it. 
HERE IS my code. 
#include <stdio.h>   
/* these arrays are just used to give the parameters to 'insert',   
   to create the 'people' array
*/

#define HOW_MANY 7 char *names[HOW_MANY]= {"Simon", "Suzie", "Alfred", "Chip", "John", "Tim","Harriet"}; 
int ages[HOW_MANY]= {22, 24, 106, 6, 18, 32, 24};

/* declare your struct for a person here */
typedef  struct{   
    char*  name;
    int   age;
} person;

static void insert( person *people[], char *name, int age,int i) {  
    /* put name and age into the next free place in the array parameter
       here */
    people[i] = malloc(sizeof(person));
    people[i]->name = name;
    people[i]->age = age;
    /* modify nextfreeplace here */
}

int main(int argc, char **argv) {

    /* declare the people array here */   
    person *people[7];

    for (int index=0;index < HOW_MANY;index=index+1)   {
        insert (&people[index], names[index], ages[index],index);
    }

    /* print the people array here*/
    for(int index=0;index < HOW_MANY;index=index+1)     {
        printf("name: %s, age: %i\n",
               people[index]->name, people[index]->age);
    }
    return 0;
}

And I get errors 

part2.c:23:5: warning: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration]
       people[i] = malloc(sizeof(person));
        ^ part2.c:23:17: warning: incompatible implicit declaration of built-in function ‘malloc’ [enabled by default]
     people[i] = malloc(sizeof(person));

Can anyone help me?  appreciate

A:

I have observed a few issues which are causing these problems.  Check the code which I have given below. 
There in the comments, I have mentioned where to make changes. 
You are using the malloc function without including the stdlib file! 
See this code,  I have tested it in dev-cpp and it's now working. 
#include <stdio.h>   
#include <stdlib.h>
/* these arrays are just used to give the parameters to 'insert',   
   to create the 'people' array
*/

#define HOW_MANY 7 
char *names[HOW_MANY]= {"Simon", "Suzie", "Alfred", "Chip", "John", "Tim","Harriet"}; 
int ages[HOW_MANY]= {22, 24, 106, 6, 18, 32, 24};

/* declare your struct for a person here */
typedef  struct{   
    char*  name;
    int   age;
} person;

/* declare the people array here */   
person *people[7];

person* insert(char *name, int age,int i) {  
    /* put name and age into the next free place in the array parameter
       here */

    people[i] = malloc(sizeof(person));
    people[i]->name = name;
    people[i]->age = age;

    /* modify nextfreeplace here */
}

int main(int argc, char **argv) {    

    int index;
    for (index=0;index < HOW_MANY;index=index+1)   {
        insert(names[index], ages[index],index);
    }

    /* print the people array here*/
    for(index=0;index < HOW_MANY;index=index+1)     {
        printf("name: %s, age: %i\n",
               people[index]->name, people[index]->age);
    }
    return 0;
}

