Hey C forum, can someone give me ideas/ psuedocode for iteration through a linked list?
I'm passing in my super-struct epg which is like this:
Code:
struct epg {
DateTime epoch; /* The time stamp from the XML file */
Channel* channelList; /* Head of a linked list of channel structs */
};
Then I want to run through this whole epg struct, printing to stdout. I have two sub-structs running off epg:
Code:
struct channel {
char *id; /* Channel id */
char *name; /* Channel name */
Programme* progList; /* Head of a linked list of programmes */
Programme* lastProg; /* Pointer to the last program in the list */
Channel* next; /* Link to the next channel in the channel list */
};
struct programme {
DateTime start; /* Start time for the programme */
DateTime stop; /* Stop time for the programme */
char* title; /* Programme title */
char* description; /* Programme description or NULL if no description given */
char* rating; /* Rating e.g. "PG". NULL if no rating available */
Programme* next; /* Link to next programme in a list */
};
I just can't visualize how to iterate through the linked lists, especially how to move to the sub-structs and back