Hi!
This coulde be a dumm question, but i can't figure it out what i am doing wrong( i haven't used two structures in each other ).
I have two structures:
struct test
{
struct ddata* difference;
int diff;
};
struct test *MSG;
struct ddata
{
char *filename;
char *size;
};
struct ddata *difference
And i want to give them values this way (and my program freezes out here):
MSG->difference = difference;
MSG->diff = diff;
So what am i doing wrong?
Thanks in advance!
kampi
EDIT:
The difference struct variable is created in one of my function (and in there i want to give value to my MSG structure). The MSG struct variable is declared globally(i don't know if this is relevant or not). The difference value is declared and filled up this way:
struct ddata *difference = (struct ddata *) malloc( dif * sizeof *difference );
memset( difference, 0, dif * sizeof *difference );
...
...
...
difference[diff].filename = strdup( primary[i].filename );
difference[diff].size = strdup( primary[i].size );
diff++;
I hope i gave you what you need.