Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shingareom/linkedlistimplementaion-clanguageproject
This C project implements a simple singly linked list data structure for managing a list of integers. The program provides an interactive user interface that allows users to perform basic operations on the linked list, such as inserting elements at the beginning, in the middle, and at the end, as well as displaying the list. The project emphasizes
https://github.com/shingareom/linkedlistimplementaion-clanguageproject
Last synced: about 1 month ago
JSON representation
This C project implements a simple singly linked list data structure for managing a list of integers. The program provides an interactive user interface that allows users to perform basic operations on the linked list, such as inserting elements at the beginning, in the middle, and at the end, as well as displaying the list. The project emphasizes
- Host: GitHub
- URL: https://github.com/shingareom/linkedlistimplementaion-clanguageproject
- Owner: ShingareOm
- License: mit
- Created: 2023-07-21T10:24:50.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-07-28T03:49:28.000Z (over 1 year ago)
- Last Synced: 2023-07-28T04:42:48.056Z (over 1 year ago)
- Language: C
- Homepage:
- Size: 160 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Singly Linked List in C 👋🤟
This C program implements a singly linked list data structure to manage a list of integers. The user can perform various operations on the linked list, including inserting elements at the beginning, in the middle, and at the end, as well as displaying the list.
## Table of Contents
- [How to Use](#how-to-use)
- [Code Explanation](#code-explanation)
- [Function Descriptions](#function-descriptions)
- [Note](#note)
- [Owner](#owner)## How to Use
1. Compile the program using a C compiler.
2. Run the compiled executable.
3. Follow the on-screen instructions to interact with the linked list.## Code Explanation
The C code defines a structure `coNode` to represent each node in the singly linked list. It contains two fields:
- `value`: An integer to store the data of the node.
- `nextvalue`: A pointer to the next node in the linked list.The program provides the following functions to manipulate the linked list:
1. `insertAtBeginning(struct coNode **head_ref, int new_data)`: Inserts a new node with the given data at the beginning of the linked list.
2. `insertAfter(struct coNode *prev_node, int new_data)`: Inserts a new node with the given data after the specified previous node in the linked list.
3. `insertAtEnd(struct coNode **head_ref, int new_data)`: Inserts a new node with the given data at the end of the linked list.
4. `printList(struct coNode *node)`: Displays the elements of the linked list along with the total number of nodes.The `main` function provides a simple user interface to perform operations on the linked list. Users can choose to insert elements at the beginning, in the middle, or at the end of the list, and also display the list.
## Function Descriptions
1. `insertAtBeginning(struct coNode **head_ref, int new_data)`: Inserts a new node with the given data at the beginning of the linked list.
2. `insertAfter(struct coNode *prev_node, int new_data)`: Inserts a new node with the given data after the specified previous node in the linked list.
3. `insertAtEnd(struct coNode **head_ref, int new_data)`: Inserts a new node with the given data at the end of the linked list.
4. `printList(struct coNode *node)`: Displays the elements of the linked list along with the total number of nodes.## Note
Please make sure to handle memory deallocation (freeing) appropriately, especially in a larger implementation, to prevent memory leaks. This simple example code does not include memory deallocation for brevity.
## Owner 😎👍
- Name: Om Shingare
- GitHub Profile: [ShingareOm](https://github.com/ShingareOm)