I am very much a beginner and trying to create a linked list, asking the "user" to input 5 or 6 values. My problem is that I don't know the correct terminology or how to store the user's input so that I can create my pointer to the next value and so on. My understanind of the topic is not great, and I think I'm missing a very easy concept. Either way...all I want to do is create the linked list and eventually be able to add more values to it if necessary.
After reading other forums, I understand that ever using the gets() is a bad idea as it has no buffer. Any help or advice is much appreciated.
Thanks.

Recommended Answers

All 3 Replies

specify the requirements clearly :

what do you want to store in linked list numbers or names(strings).
if numbers are to be stored use scanf
else use fgets or
you can define one safe function for reading strings.
post your program here so that you will get some guidelines on how to follow.

I am very much a beginner and trying to create a linked list, asking the "user" to input 5 or 6 values. My problem is that I don't know the correct terminology or how to store the user's input so that I can create my pointer to the next value and so on. My understanind of the topic is not great, and I think I'm missing a very easy concept. Either way...all I want to do is create the linked list and eventually be able to add more values to it if necessary.
After reading other forums, I understand that ever using the gets() is a bad idea as it has no buffer. Any help or advice is much appreciated.
Thanks.

@nick
linked is is not so difficult,you have to think what you are going to do then generate your code:
here wm defining you how to initialize a linked list
first of all build a structure of node like this
struct node
{
and then initialize the data type ,like if you want to take name,age,height of the user as input so initialize their data type like this:
char name[20];
int age;
float height;
after initializing them initialize the next pointer,which will point your next node like this
node*next;
this is the structure of a node in linked list..
here is the complete code of it:
sruct node
{
char name[20];
int age;
float height;
node *next;
};

I am very much a beginner and trying to create a linked list, asking the "user" to input 5 or 6 values. My problem is that I don't know the correct terminology or how to store the user's input so that I can create my pointer to the next value and so on. My understanind of the topic is not great, and I think I'm missing a very easy concept.

Sounds like you need to learn and understand what a linked list is and how it operates. http://en.wikipedia.org/wiki/Linked_listStart here[/url].

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.