kubiej21
kubiej21

Reputation: 698

Is a linked list in a struct possible?

I am working on an assignment that deals with storing and sorting some data. I had an idea to create a simple data structure as follows:

struct names 
{
char username[9];
linked list of structs
}

struct login
{
char ip_addr[16];
int count;
}

I have my linked-list of login structs working properly, however, I am unsure as to how I would go about inserting a linked-list of structs into a different linked-list of structs. Is it even possible?

Upvotes: 0

Views: 877

Answers (1)

shan
shan

Reputation: 1202

Yes, put the header node pointer inside your names struct.

Upvotes: 7

Related Questions