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
Add a second malloc for whatever length (N) you need for word
malloc
word
mystruct* structptr = malloc(sizeof(mystruct)); structptr->word = malloc(sizeof(char) * N);