I have a problem related with this program :
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct people
{
char full_name [100];
char age [100];
char phone_number [100];
} Person;
typedef struct address
{
Person *person_list;
} Address_book;
void print_person(const Person* person)
{
printf("full_name : %s \n", person->full_name);
printf("age : %s \n", person->age);
printf("phone_number : %s \n", person->phone_number);
}
void getinput (char *string)
{
ssize_t read = 0;
char *line = NULL;
size_t n = 0;
read = getline (&line, &n, stdin);
if (line[read - 1] == '\n')
{ line[read - 1] = 0; read--; }
strncpy (string, line, read);
if (line) free (line);
}
void create_address_book(Address_book* address_book)
{
printf("insert full name : ");
getinput(address_book->person_list->full_name);
printf("insert age : ");
getinput(address_book->person_list->age);
printf("insert phone_number: ");
getinput(address_book->person_list->phone_number);
}
int main()
{
Address_book* test = (Address_book*) malloc(sizeof(Address_book));
create_address_book(&test);
print_person(&test);
return 0;
}
it compiled but when I tried to run the program, it gave result like this :

do you know what the problem is in this program?? I am still new to C structs and pointers so I would like to get some help or perhaps some explanations about this problem. Any help would be really appreciated.
I tried out your code as is, and the first hint that things probably were going to be unpredictable were listed in the compiler warnings.
And launching the program produced basically the same results as you noted.
At issue is that the code was attempting to pass a "pointer to a pointer".
So after correcting that, this highlighted the next issue noted in the comments about the address structure having an uninitialized pointer causing a segment fault.
To come up with simplest solution so that your code will initially work, I refactored the definition of the "Address_book" structure to define an array of 100 "Person" structures (100 was an arbitrary value).
So, the two refactored blocks of code were the "Address_book" structure and the refinement and correction of the pointer usage in the various function calls within the "main" function.
This resulted in what looks to be the functionality you were trying to achieve.
There probably are other areas that could be refined, but review these bits of refactoring to hopefully help you understand pointer usage and memory allocation.