This lab concentrates on learning to create and perform some basic operations on a singly-linked list of integers. For this project just create a single file with main and all of the other needed code. 1. First you need to define the data structure(s) for your program. You will need a struct definition for your nodes: struct node { // see notes }; And define a singly-linked list type to be a pointer to one of these nodes: typedef struct node *llist; 2. We will have two kinds of lists to deal with empty and non-empty lists. We will use the value NULL to designate an empty list. And to abstract-away the details on creating a list we will define a very simple function called createList that just "returns" an empty list, i.e. NULL: llist createList() { return NULL; } So add this function to your code. Now we would be able to do the following: llist 1 createList(); 3. Now write a function to print a list, printing the string NULL if the list is empty. void printList (llist); // prints contents of list with no newline In writing this function you will have two cases in an if statement and if the list is not empty you traverse the list printing out the contents of each node. So now the following code should work in main and just print NULL: llist 1 createList(); printList (1); printf("\n");
This lab concentrates on learning to create and perform some basic operations on a singly-linked list of integers. For this project just create a single file with main and all of the other needed code. 1. First you need to define the data structure(s) for your program. You will need a struct definition for your nodes: struct node { // see notes }; And define a singly-linked list type to be a pointer to one of these nodes: typedef struct node *llist; 2. We will have two kinds of lists to deal with empty and non-empty lists. We will use the value NULL to designate an empty list. And to abstract-away the details on creating a list we will define a very simple function called createList that just "returns" an empty list, i.e. NULL: llist createList() { return NULL; } So add this function to your code. Now we would be able to do the following: llist 1 createList(); 3. Now write a function to print a list, printing the string NULL if the list is empty. void printList (llist); // prints contents of list with no newline In writing this function you will have two cases in an if statement and if the list is not empty you traverse the list printing out the contents of each node. So now the following code should work in main and just print NULL: llist 1 createList(); printList (1); printf("\n");
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Linked lists. Please help, the program is in C language
Expert Solution
Step 1
Answer:
Our guidelines is answer the first three question from the first question .so we have done first three question
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
Please answer the remaining questions. This is supposed to be one question with multiple parts
Solution
by Bartleby Expert
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education