Hi, I have a linked list which I created in a function? I want to allow the user to enter a name for the linked list, and then after he/she can display the list by typing in the title. This is part of my code

struct llistt{
char str[100];  // where the strings will be kept
struct llistt *next
struct llistt *prev
}

typedef struct llistt node

Right now your list consists only of nodes. If you want data that applies to the list as a whole, you should create a new structure that contains a list as well as that data:

struct node {
  char str[100];  // where the strings will be kept
  struct node *next
  struct node *prev
};

struct list {
  char name[100];
  struct node *head;
};

typedef struct node node;
typedef struct list list;

Then you use it the same way, just instead of arbitrary pointers for the head of the list, you store it in a list object.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.