Write a program that reverses a singly linked list

Assignment Help Software Engineering
Reference no: EM13311858

A.What is the output of the following program? Why?

#include
main() {
typedef union {
int a;
char b[10];
float c;
}Union;
Union x,y = {100};
x.a = 50;
strcpy(x.b,"hello");
x.c = 21.50;
printf("Union x : %d %s %f n",x.a,x.b,x.c);
printf("Union y : %d %s %f n",y.a,y.b,y.c);
}
B.Write a C program named sum.c that adds up its command line arguments, which are assumed to be integers. Running the program by typing:

sum 8 24 62

should produce the following output:

Total: 94

Your program should work for any number of typed in numbers.


C.Given the function below. What would happen if the first parameter would be struct node *list instead of struct node **list? Explain why.
void add_to_list(struct node **list, int n)
{
struct node *new_node;
new_node = malloc(sizeof(struct node));
if (new_node == NULL) {
printf("Error: malloc failed in add_to_list\n");
exit(EXIT_FAILURE);
}
new_node->value = n;
new_node->next = *list;
*list = new_node;
}
D. Modify the inventory2.c program by adding an e (erase) command that allows the user to remove a part from the database.

Please see the inventory2.c file

E.Write a program that reverses a singly linked list.


Attachment:- 321688_2_inventory2.rar

Reference no: EM13311858

Questions Cloud

Explain a cell composed of a platinum indicator electrode : A cell composed of a platinum indicator electrode and a silver-silver chloride reference electrode in a solution containing both Fe2 and Fe3 has a cell voltage of 0.719 V. If the silver-silver chloride electrode is replaced with a saturated calome..
What is the average speed and velocity : An object starts from the origin and goes along the x-axis to x = 10 m in 2 s, stops for 5.5 s, and then travels at v = -4 m/s for 2.5 s
Find the current that the battery delivers to the lighter : A cigarette lighter in a car is a resistor that, when activated, is connected across the 12-V battery. Find the current that the battery delivers to the lighter
Article population and environment : Do you think we will have a war over fuel, food or water and give examples to support your ideas and click this link to read the article Population & Environment and prepare a response in a paragraph.
Write a program that reverses a singly linked list : iven the function below. What would happen if the first parameter would be struct node *list instead of struct node **list? Explain why.
Determine the mass of the planet : A small moon of a giant planet has an orbital period of 1.74 days and an orbital radius of 4.02 105 km. determine the mass of the planet
Find the acceleration of the block down the incline : A block of mass M= 100 kg is sliding down an inclined at an angle q= 30 degree above the horizontal. Find the acceleration of the block down the incline
Explain the maximum mass of aluminum chloride : What is the maximum mass of aluminum chloride that can be formed when reacting 29.0g of AL with 34.0g of Cl
What is the change in potential energy of the coil : A coil with magnetic dipole moment 1.5 A-m^2 is rotated initally with its magnetic moment parallel to a uniform magnetic field of 0.4T. what is the change in potential energy of the coil

Reviews

Write a Review

Software Engineering Questions & Answers

  Create a diagram for many-to-many relationship of entity

One-to-many or many-to-many relationship. Then, using short-hand notation introduced in text, create a diagram for each of the relationships.

  Create pseudocode to compute produce sale

Suppose that all products are priced per pound. As soon as program starts, it should prompt for and get the prices of those products.

  Deisgn flowchart-hierarchy chart and pseudocode for program

Deisgn a flowchart, hierarchy chart, and pseudocode for program to solve following problem: A student borrows $3,000 at the interest rate of 2 percent per month on unpaid balance.

  Why is it important to have a communication plan

Why is it important to have a communication plan and produce a small version of the communication plan that includes at least two key entries that you would expect for this project.

  Discuss the legal issues for images

Kudler Fine Foods has used commercial stock photography brokers for picture on its Internet site and for its print advertising.

  Determine the remaining balance

A student borrows 3,000 at an interest rate of two percent per month on the unpaid balance. If the student pays $200 at the end of every month, Determine the remaining balance at the end of one year?

  Challenges of software development projects

Define and explain, in your own words, the primary challenge(s) of software development projects and compare and contrast at least three (3) different software development methods.

  Create a table with a primary key to identify business

Construct a table that will store data about each student that took a course and what grade they received. The data should include the semester of completion.

  What might be your key decision rules

You are a manager in a company that has a lot of in-house IS expertise. What might be your key decision rules for when to purchase a system versus when to develop it in-house?

  Design 10 test cases

Design ten test cases and describe the purpose of each of them. The cause is one to two sentences.

  Design a prototype for a hospital management system

You are to design a prototype for a hospital management system. Patients are treated in a single ward by the doctors assigned to them. Usually each patient will be assigned a single doctor, but in rare cases they will have two.

  Why does the newness of a project technology increase

Why does the newness of a project's technology increase its complexity?Project Phases and Organization.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd