Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write c program for Create a linked list and Delete an element before a particular element. If there are more than one similar elements in

write c program for Create a linked list and Delete an element before a particular element. If there are more than one similar elements in the linked list, delete the element before the last occurrence.
Sample Input/Output
Input:
1742161839-999
16
Output
17161839 for the above program got below errors please fix them. warning: struct node declared inside parameter list will not be visible outside of this definition or declaration
7| void deleteBefore(struct node **head_ref,int x){
|^~~~
linkedList_InsertAfter.c: In function deleteBefore:
linkedList_InsertAfter.c:8:21: warning: initialization of struct Node * from incompatible pointer type struct node *[-Wincompatible-pointer-types]
8| struct Node* temp =*head_ref;
|^
linkedList_InsertAfter.c:22:14: warning: assignment to struct node * from incompatible pointer type struct Node *[-Wincompatible-pointer-types]
22| last = temp;
|^
linkedList_InsertAfter.c:30:6: warning: assignment to struct Node * from incompatible pointer type struct node *[-Wincompatible-pointer-types]
30| temp =*head_ref;
|^
linkedList_InsertAfter.c:31:13: warning: comparison of distinct pointer types lacks a cast
31| while (temp != last)
|^~
linkedList_InsertAfter.c:33:10: warning: assignment to struct node * from incompatible pointer type struct Node *[-Wincompatible-pointer-types]
33| prev = temp;
|^
linkedList_InsertAfter.c: At top level:
linkedList_InsertAfter.c:38:5: error: expected =,,,;,asm or __attribute__ before -> token
38| prev->next = last;
|^~
linkedList_InsertAfter.c:39:1: error: expected identifier or ( before } token
39|}
|^
linkedList_InsertAfter.c:40:20: warning: struct node declared inside parameter list will not be visible outside of this definition or declaration
40| void append(struct node **head_ref, int data){
|^~~~
linkedList_InsertAfter.c: In function append:
linkedList_InsertAfter.c:42:57: error: invalid application of sizeof to incomplete type struct node
42| struct node *new_node =(struct node*)malloc(sizeof(struct node));
|^~~~~~
linkedList_InsertAfter.c:43:13: error: dereferencing pointer to incomplete type struct node
43| new_node->data = data;
|^~
linkedList_InsertAfter.c: In function main:
linkedList_InsertAfter.c:64:16: warning: passing argument 1 of append from incompatible pointer type [-Wincompatible-pointer-types]
64| append(&head, data);
|^~~~~
||
| struct node **
linkedList_InsertAfter.c:40:27: note: expected struct node ** but argument is of type struct node **
40| void append(struct node **head_ref, int data){
| ~~~~~~~~~~~~~~^~~~~~~~

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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

ISBN: ? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

Azure Analytics is a suite made up of which three tools?

Answered: 1 week ago

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago