typedef struct mensagem
{
    int sender ;
    int receiver ;
    char *text ;
} *Item ;
typedef struct node 
{
    Item item ;
    struct node *next ;
} *link ;
link init(char* text)
{
    link x = (link) malloc(sizeof(struct node));
    (x->item->text) = (char*) malloc(sizeof(char)*(strlen(text)+1));
    strcpy(x->item->text, text);
    x->next = NULL;
    return x;
}
I meant to use the data inside item, but I get a Segmentation Fault on the line:
(x->item->text) = (char*) malloc(sizeof(char)*(strlen(text)+1));
I'm fairly new to C and pointers, but I can't find the problem here.
 
     
     
    