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

  Research report on software design

Write a Research Report on software design and answer diffrent type of questions related to design. Report contain diffrent basic questions related to software design.

  A case study in c to java conversion and extensibility

A Case Study in C to Java Conversion and Extensibility

  Create a structural model

Structural modeling is a different view of the same system that you analyzed from a functional perspective. This model shows how data is organized within the system.

  Write an report on a significant software security

Write an report on a significant software security

  Development of a small software system

Analysis, design and development of a small software system.

  Systems analysis and design requirements

Systems Analysis and Design requirements

  Create a complete limited entry decision table

Create a complete limited entry decision table

  Explain flow boundaries map

Explain flow boundaries map the dfd into a software architecture using transform mapping.

  Frame diagrams

Prepare a frame diagram for the software systems.

  Identified systems and elements of the sap system

Identify computing devices, which could be used to support Your Improved Process

  Design a wireframe prototype

Design a wireframe prototype to meet the needs of the personas and requirements.

  Explain the characteristics of visual studio 2005

Explain the characteristics of Visual Studio 2005.

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