C structure within structure problem, need help
I have a structure and within that structure, i have a declaration of a structure of type different structure. So im trying to store data through a function that only passed the artist type structure.
struct cd {
int cdnum;
int cdcount;
char cdtitle[80];
struct cd *next;
};
struct artist
char name[80];
struct cd *link;
};
so in a function i later write, a structure of type artist is passed by pointer. I want to store data into the "cd structure" portion of the artist structure.
this is what i thought would work:
scanf("%d", p->link.cdnum);
but it doesn't and im stumped. I still think it would work even though it wont compile :). can someone help me out?
heres the protype for that later function just incase:
void newcd(struct artist *p,int size);