typedef struct roster_list
{
char *name; // info in current node
struct roster_list *next; // next node
} ROSTER_LIST;
struct roster_list {
char *name; // info in current node
CLAN_DATA *clan; // more info in current node
int gold; // even more info in current node
struct roster_list *next; // next node
};
ptr->name; // Access name of the current node
ptr->clan; // Access clan of the current node
ptr->gold; // Access gold of current node?
struct roster_list {
char *name; // info in current node
};
list<struct roster_list*> global_roster; // list structure ready to be populated with roster_list objects.
ptr = (struct roster_list*) malloc(sizeof(struct roster_list));
ptr->name; // assign it
r_list.push_front(ptr); // Puts ptr in the front of the list
// Can also use push_back()
r_list.remove(ptr); // Removes ptr from the list.
list<int> ilist;
ilist.push_front(10);
ilist.push_front(15);
ilist.push_front(20); // list contains 10, 15, 20
// Now we iterator through the list and access each value.
for(list<int>::iterator i = ilist.begin(); i != mylist.end(); i++)
*i; // dereferencing i accesses each element.
list<roster_node> global_roster;
roster_node r;
r.name = "bob"; // <– this is assuming that you're using std::string and not char*,
// otherwise use stralloc or whatever
r.level = 27;
global_roster.push_back(r);
The usual linked list structure:
Currently I'm thinking for my clan roster code, something like this:
Each node being this struct:
This is my thoughts so far:
On more research, it looks like I'm trying to create a Chunk list,
but I couldn't find squat on them as far as a structure etc.