#include   // Part 1 //Declare a node of character // each node has a value and a pointer that points to the next node struct charNode {             __1__ val;             __2__ __3__ next; };   /*This function takes the first pointer (head) and iterates through the list             to print one character at a time.*/ __4__ printCharLL(__5__ __6__ curPtr) {             printf("\nPrinting back the list: \n");             while(__7__ __8__ __9__) //condition to keep running the loop             {                         printf("%c", __10__);  //print the value using pointer, no spaces                         curPtr = __11__; //move the pointer to point to the next node in list, no spaces             }             printf("\n"); }   // Part 2 //Declare a node of double // each node has a value and a pointer that points to the next node struct doubleNode {             __12__ val;             __13__ __14__ next; };   /*This function takes the first pointer (h) and iterates through the list             to print one double at a time.   Note the the format for double is %lf. We'll round to 3 decimal places, and there'll be tab in between each double for readability.*/ __15__ printDoubleLL(__16__ __17__ h) {             printf("\nPrinting back the list: \n");             while(__18__ __19__ __20__)             {                         printf("%.3lf\t", __21__); //print the value using pointer, no spaces                         h = __22__; //move the pointer to point to the next node in list, no spaces             }             printf("\n"); }   /*This function takes the first pointer (head) and iterates through the list             to get the one double at a time from the user, and save it to our list   Note the the format for double is %lf. */ __23__ scanDoubleLL(__24__ __25__ head) {             printf("Please fill in 4 values for our linked list.\n");             while(__26__ __27__ __28__)             {                         printf("Enter a double: ");                         scanf("%lf", & __29__);//get the value from user using pointer, no space                         head = __30__;//move the pointer to point to the next node in list, no spaces             } }   int main() {             //PART 1             //Create 5 character nodes, and link a head pointer to first node.             __31__ __32__ cn1, cn2, cn3, cn4, cn5; //nodes             __33__ __34__ head = __35__;  //head pointer points to first node cn1, no spaces               //Assign values to all nodes to make "Hello", no spaces             __36__ = __37__; //value for cn1.             __38__ = __39__; //value for cn2.             __40__ = __41__; //value for cn3.             __42__ = __43__; //value for cn4.             __44__ = __45__; //value for cn5.               //Link all nodes, no spaces             __46__ = __47__; //make a link from cn1 to cn2             __48__ = __49__; //make a link from cn2 to cn3             __50__ = __51__; //make a link from cn3 to cn4             __52__ = __53__; //make a link from cn4 to cn5             __54__ = __55__; //make a link to show cn5 is the end               //Call function printCharLL() to print Hello             printCharLL(__56__);               //PART 2             //Create 4 double nodes, and link the a head pointer to first node.             __57__ __58__  dn1, dn2, dn3, dn4; //nodes             __59__ __60__ head2 = &dn1;  //head pointer points to first node dn1, no spaces               //Link all nodes first so that we don't have to ask the user individually             // if we don't link first, we'll have to ask value for each node's value manually             __61__ = __62__; //make a link from dn1 to dn2             __63__ = __64__; //make a link from dn2 to dn3             __65__ = __66__; //make a link from dn3 to dn4             __67__ = __68__; //make a link to show dn4 is the end               //Get values from the user             scanDoubleLL(__69__);                                     //Call function printCharLL() to print Hello             printDoubleLL(__70__);               return 0

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
icon
Related questions
icon
Concept explainers
Question

Please fill in the blanks for C.

// Singly Linked List

 

#include<stdio.h>

 

// Part 1

//Declare a node of character

// each node has a value and a pointer that points to the next node

struct charNode

{

            __1__ val;

            __2__ __3__ next;

};

 

/*This function takes the first pointer (head) and iterates through the list

            to print one character at a time.*/

__4__ printCharLL(__5__ __6__ curPtr)

{

            printf("\nPrinting back the list: \n");

            while(__7__ __8__ __9__) //condition to keep running the loop

            {

                        printf("%c", __10__);  //print the value using pointer, no spaces

                        curPtr = __11__; //move the pointer to point to the next node in list, no spaces

            }

            printf("\n");

}

 

// Part 2

//Declare a node of double

// each node has a value and a pointer that points to the next node

struct doubleNode

{

            __12__ val;

            __13__ __14__ next;

};

 

/*This function takes the first pointer (h) and iterates through the list

            to print one double at a time.

  Note the the format for double is %lf. We'll round to 3 decimal places,

and there'll be tab in between each double for readability.*/

__15__ printDoubleLL(__16__ __17__ h)

{

            printf("\nPrinting back the list: \n");

            while(__18__ __19__ __20__)

            {

                        printf("%.3lf\t", __21__); //print the value using pointer, no spaces

                        h = __22__; //move the pointer to point to the next node in list, no spaces

            }

            printf("\n");

}

 

/*This function takes the first pointer (head) and iterates through the list

            to get the one double at a time from the user, and save it to our list

  Note the the format for double is %lf. */

__23__ scanDoubleLL(__24__ __25__ head)

{

            printf("Please fill in 4 values for our linked list.\n");

            while(__26__ __27__ __28__)

            {

                        printf("Enter a double: ");

                        scanf("%lf", & __29__);//get the value from user using pointer, no space

                        head = __30__;//move the pointer to point to the next node in list, no spaces

            }

}

 

int main()

{

            //PART 1

            //Create 5 character nodes, and link a head pointer to first node.

            __31__ __32__ cn1, cn2, cn3, cn4, cn5; //nodes

            __33__ __34__ head = __35__;  //head pointer points to first node cn1, no spaces

 

            //Assign values to all nodes to make "Hello", no spaces

            __36__ = __37__; //value for cn1.

            __38__ = __39__; //value for cn2.

            __40__ = __41__; //value for cn3.

            __42__ = __43__; //value for cn4.

            __44__ = __45__; //value for cn5.

 

            //Link all nodes, no spaces

            __46__ = __47__; //make a link from cn1 to cn2

            __48__ = __49__; //make a link from cn2 to cn3

            __50__ = __51__; //make a link from cn3 to cn4

            __52__ = __53__; //make a link from cn4 to cn5

            __54__ = __55__; //make a link to show cn5 is the end

 

            //Call function printCharLL() to print Hello

            printCharLL(__56__);

 

            //PART 2

            //Create 4 double nodes, and link the a head pointer to first node.

            __57__ __58__  dn1, dn2, dn3, dn4; //nodes

            __59__ __60__ head2 = &dn1;  //head pointer points to first node dn1, no spaces

 

            //Link all nodes first so that we don't have to ask the user individually

            // if we don't link first, we'll have to ask value for each node's value manually

            __61__ = __62__; //make a link from dn1 to dn2

            __63__ = __64__; //make a link from dn2 to dn3

            __65__ = __66__; //make a link from dn3 to dn4

            __67__ = __68__; //make a link to show dn4 is the end

 

            //Get values from the user

            scanDoubleLL(__69__);

           

           

            //Call function printCharLL() to print Hello

            printDoubleLL(__70__);

 

            return 0;

}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Types of Linked List
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education