answersLogoWhite

0

Insert method linked list C

User Avatar

Kriz10

Lvl 1
15y ago
Updated: 8/17/2019

List insert(List l, int val)

{

List new = malloc(sizeof(struct node));

new->value = val;

new->next = NULL;

if(l==NULL)

return new;

else

{

List aux;

aux = l;

while(aux->next != NULL)

aux = aux->next;

aux->next = new;

return aux;

}

}

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

What is meant by doubly linked list?

In C programming, a double linked-list refers to a linked data structure that contains a set of links that have been linked sequentially.


32 can you create a linked list with out structure pointer?

Not in C, no.


Write a algorithm for doubly linked list in c?

sorry


What is linked list in C langauage?

A linked list is a collection of items, often nodes, that are sequentially linked by some kind of index or pointer contained within each item.


What is the code for c and c plus plus program to merge two circular linked list?

Circular linked lists are really no different to ordinary linked lists, other than that the tail node points back to the head node (and vice versa if the list is doubly-linked). Therefore the merge process is exactly the same: iterate through the second list and insert each node's data into the first list. Since lists are un-associated containers, it doesn't matter where the insertions occur but, by convention, insertions typically occur at the tail of the list. If an order must be maintain, an insertion sort should be employed instead. Note that if you need to maintain the original two lists (in their un-merged state), simply copy the first and insert the second into the copy instead.


Which of the following data structures can be randomly accessed giving loc A. linked list implemented using array B. singly linked list C. double linked list D. both single and double linked list?

Which of the following data structures can be randomly accessed giving loc?A. linked list implemented using arrayB. singly linked listC. double linked listD. both single and double linked listThe answer is A.


Write a program in C to create a Circular Linked list?

#include<iostream.h>


To enter n nos without using arrays in c?

Use a linked-list.


How do you edit a node in linked list C plus plus?

oh well. it is like this


What pointer type will you use to implement a heterogeneous linked list in c?

void pointer


Program for inserting a new node in between two list in c?

To insert a new node between two lists, append the new node to the first list, then insert the head node of the second list after the new node.


Evaluate the polynomial expression using linked list using c?

Evaluating a Polynomial expression using a singly linked list visit : http://myfundatimemachine.blogspot.in/2012/06/polynomial-evaluation-in-c.html