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

3 Years
Discussion Span
Last Post by 111100/11000

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.

//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


Edited by 111100/11000

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.