I have the following struct in C:
typedef struct
{
int age;
char name[20];
} Person;
in the main() I have:
Person *person;
person->age = 21;
This causes a segmentation fault, I have tried Googling but the resources that I have found do not have the struct declared as a pointer. I need this struct to be declared as a pointer so that it can be passed into another function. How would I properly access the members of this struct? (I also need to do this for char).
malloc()