I have these two structures :
struct member {
char *nickname;
char *group;
};
struct node {
struct member mbr;
struct node *next;
};
Further in my code I do this :
struct node* n = (struct node*)malloc(sizeof(struct node));
And get a "Segmentation fault" error at this line when I run the program :
strcopy(n->mbr.nickname, temp->nickname);
I've been trying for a while to solve this problem and I've searched on the web, but I didn't find any solution yet. I'm guessing the structure inside 'n' isn't initialized. I did a few test that looked like :
n->mbr = (struct member*)malloc(sizeof(struct member));
But then I get another error : "incompatible types when assigning to type 'struct member' from type 'struct member *'"...
Can anyone tell me what I'm doing wrong? Thanks.
strcopy()a typo or your own function?