Try this:
Code:
void details(struct artist *p, int size){
char name[80];
int i = 0;
printf("Enter the artist name:\n");
fgets(name, sizeof(name), stdin);
while( i < 100){
if (strcmp(p[i].name, name) == NULL){
printf("Artist: %s\n", p[i].name);
printf("CD title: %s\n", p[i].link.cdtitle);
printf("Stocked: %d\n", p[i].link.cdcount);
break;
}else{
i++;
}
}
}
p is an array of structures, so you access it like an array but you access it's members as if it were just a single structure, ie. with the dot operator
You also want to exit the loop upon finding what you were searching for to save processing time.
-Prelude