I was struggling to fix a code today, then I come across something similar to:
typedef struct { int a; int b; int c; int d; char* word; } mystruct; int main(i
as you can read here you need to allocate the char * separately :
char *
mystruct* structptr = malloc(sizeof(mystruct)); structptr->word = malloc(sizeof(WhatSizeYouWant));