A few simple corrections are required to your code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct People
{
int id;
char name[20];
int age;
};
void insert(struct People *array, int i) {
printf("\nInsert name of %d. person: ", i);
scanf("%s", array[i].name); printf("Insert age of %d. person: ", i);
scanf("%d", &array[i].age); }
int main()
{
int i = 0, add;
struct People array[100];
printf("\nType 1 to add a new person ");
scanf("%d", &add);
while(add==1)
{
insert(array, i); i++;
printf("\nType 1 to add a new person ");
scanf("%d", &add);
}
for (add = 0; add < i; add++)
{
printf("%s is %d years old\n", array[add].name, array[add].age);
}
}
Notes:
1. Parameter 1 is a pointer to the first element of an array of People structs, so it does not require the square brackets.
2. The name variable is an array of characters so it does not need the adressof operator (&).
3. However, the age variable is a single integer so it does need the adressof operator.
4. The insert function requires the address of the array, so it only needs to pass the name, as that is a pointer to the first element.