I'm having a problem with incompatible pointer types
[Warning] assignment from incompatible pointer type
Code:
struct CD {
unsigned int ID;
char *Title;
char *Artist;
char *Genre;
int Year;
int Time;
int Number_Tracks;
struct Songs *Track_Ptr;
};
struct Node {
struct CD *CD_Ptr; // payload (CD information)
struct Node *Next_Ptr; // point to next (linked-list)
};
void dbload();
char temp[MAX_TITLE_LEN], tempa[MAX_NAME_LEN];
struct Node *head_ptr, *tail_ptr, *cur_ptr;
fscanf(fp1, "%[^\t]\t %[^\t]\n", &temp, &tempa);
cur_ptr = (struct Node*)malloc(sizeof(struct Node));
cur_ptr->CD_Ptr = (struct CD*)malloc(sizeof(struct CD));
if (cur_ptr == NULL) exit(1);
cur_ptr->Next_Ptr = NULL;
if (head_ptr == NULL)
head_ptr = cur_ptr;
else
tail_ptr->Next_Ptr = cur_ptr;
tail_ptr = cur_ptr;
cur_ptr->CD_Ptr->Title = (struct CD*)malloc(strlen(temp));
strncpy(cur_ptr->CD_Ptr->Title, temp, MAX_TITLE_LEn);
cur_ptr->CD_Ptr->Artist = (struct CD*)malloc(strlen(tempa));
strncpy(cur_ptr->CD_Ptr->Artist, tempa, MAX_NAME_LEN);
I tried switching the (struct CD*) to (struct Node*), thinking that would fix it, but it doesn't
Oddly enough, it gives me a warning if I have the Title bit in there, but runs fine. As soon as I add the Artist bit, crash and burn.
Also, after putting the code into this message, I hit F9 trying to compile it....