Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the program by writing the missing code for list insert. 1 / * * same output as 1 1 - linked - list.c ,

Complete the program by writing the missing code for list insert.
1
/*
* same output as 11-linked-list.c, but
* uses list_insert(). note that list_insert()
* is called in reverse order
*/
#include
#include
#include
#define LEN 3// airport code len
struct node {
char code[LEN+1];
struct node *next;
};
void list_insert(char *s, struct node **start);
void list_print(struct node *p);
int main(void)
{
struct node *head = NULL;
list_insert("BKK", &head);
list_insert("PNH", &head);
list_insert("SGN", &head);
list_print(head);
return 0; }
/* insert node at beginning of list */
void list_insert(char *s, struct node **start)
{
// missing code goes here
}
void list_print(struct node *p)
{
while (p != NULL){
printf("%s
", p->code);
p = p->next;
}}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

More Books

Students also viewed these Databases questions

Question

=+ What characters could become part of everyday culture?

Answered: 1 week ago

Question

=+1. Work in teams of four or five.

Answered: 1 week ago

Question

=+5. Now write the same commercial as a 15-second spot. Think about

Answered: 1 week ago