I'm trying to make a linked list, what's wrong with my syntax for adding a node?
struct data {
char name[20];
char number[10];
};
typedef struct node {
struct data list;
struct node* next;
} Node;
Node *head = 0;
Node *tail = 0;
Node *New = 0;
void add(char* name, char* number) {
New = (Node *) malloc(sizeof(Node));
New->list.name = name; /* incompatible type assignment, from char* to char[20] */
New->list.number) = number; /* same error */
New->next = 0;
if (tail != 0) {
tail->next = New;
tail = New;
}
else {
tail = New;
head = New;
}
}