function find_young() have to receive pointer p as an actual parameter.
And p have to point a struct s which has youngest person.
There is no error message but the program isn't work.
Please give me some advice.
typedef struct
{
char *name;
int age;
} PERSON;
void find_young(PERSON **ip)
{
PERSON s[3] = {{"John", 25}, {"Brandon", 28}, {"Alex", 30}};
int i;
int min = s[0].age;
for(i = 0; i < 3; i++)
{
if(min > s[i].age)
**ip = s[i];
}
}
int main()
{
PERSON *p;
find_young(&p);
printf("The youngest person is %s.\n", p->name);
}
PERSON *p;-->PERSON p;alsos[0]is not set when the minimum.PERSON aMan; PERSON *p = &aMan;