My questions have to do with very early stages of learning lists in C.I haven't been able to find a clear answer to my questions anywhere whether it has to to with the simplest code there is.(I'm going to give you an example of what i don't clearly understand on a very simple code just for you to get where i lose my understanding.It's the same question i have with more complicated ones.)
struct node{
int data;
struct node *next;
};
i get what data and next are used for as variables but i don't get: what struct node *next really means.Do we create a new stuct named next that has new data and next members?What i also don't get is the * usage in next.
**Below follows a code that aims to create tabs and add site addresses to these tabs.Kind of what a borwser would do.InfoSession in an informational code.The list i'm creating is a double linked list.**But i don't understand two things: 1)What does really TabNodePtr LastTab mean for example?Is LastTab a new struct now that has all the above :
TabNodePtr PrevTab, NextTab;
SiteNodePtr FirstSite;
SiteNodePtr CurrSite;
as members?Same with the SiteNodePtr s. I don't get how they are all linked together it's all a ball of christmas garlands to me right now. 2)Why do we use pointers for the members?And don't just go with TabNode LastTab for instance?Where do pointers make a diffrence and we must add them?
typedef struct TabNode *TabNodePtr;
typedef struct SiteNode *SiteNodePtr;
struct InfoSession {
TabNodePtr FirstTab;
TabNodePtr LastTab;
TabNodePtr CurrTab;
};
struct TabNode {
TabNodePtr PrevTab, NextTab;
SiteNodePtr FirstSite;
SiteNodePtr CurrSite;
};
struct SiteNode{
SiteNodePtr PrevSite, NextSite;
TabNodePtr UpTab;
};