Say I have a struct:
typedef struct entry{
char name[40]; /* Contains name */
char phone_number[9]; /* Contains phone number */
struct entry *next ; /* next is used to navigate through structures. */
} contact;
I have a pointer:
contact *email, *address;
In my main(), I dynamically assign memory by use of malloc():
/* malloc() to create a dynamic-sized array for email/home addresses. */
email = (contact*)malloc(sizeof(contact));
address = (contact*)malloc(sizeof(contact));
How can I modify my struct so that I can make use of the email/address pointers to store a corresponding value (email/address) into it dynamically?
I feel I'm missing out some declarations in my struct in order for my pointers to store the corresponding value. What have I missed out?