I have a conceptual question. If I have some structures declared thus:
Code:
struct film
{
char title[TSIZE];
int rating;
};
typedef struct film Item;
typedef struct node
{
Item item;
struct node * next;
} Node;
typedef Node * List;
And I decide to re-define List as:
Code:
// typedef Node * List;
typedef struct list {
Node * head;
Node * end;
} List;
Would the references to the item member of Node then become:
Code:
List * plist;
plist->head->item;
// and/or
plist->end->item;
I ask because I had a structure assignment that used to work:
Code:
static void CopyToNode(Item item, Node * pnode)
{
pnode->item = item; // copying structure
}
After the 'List' definition change (mentioned above), I changed the CopyToNode() to:
Code:
static void CopyToNode(Item item, List * plist)
{
plist->end->item = item; // copying structure
}
The files compile with no errors, but the program crashes on the 'copying structure' line.
What am I forgetting?