I'm new to c and i need to put the following string from a file into a linked list :


i also need to put "1,2,3,4" in an array but only the numbers. I would really appreciate your help.

Thank you

Create a structure to hold the data. The numeric data can be in an array that is part of the structure. Then you assign the structure as the data part of your linked list. There are singly linked lists (each node has a pointer to the next node) and doubly linked lists (each node has a pointer to the next as well as the previous node). Basically, each node has 2 or 3 elements. For a singly linked lists there are two. One element is a pointer to the data, the other is the pointer to the next node in the list.

Member Avatar for 111100/11000
//3 structs linked together in a linked list
 _______       _______       _______
|data#1 |     |data#2 |     |data#3 |

idea is to have an instance of a struct that has data and a pointer which points to another instance of a struct that has different data and points to another instance of a struct with different data and so on 'till last struct which points to NULL so when you go through the linked list you should check if struck points to NULL in which case that is the last element(struct) of a linked list


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.