EmbLogic's Blog

Code to demonstrate how to delete M nodes after N nodes in a single linked list in C .

RCS file: delete_M_nodes_after_N.c,v
Working file: delete_M_nodes_after_N.c
head: 1.9
branch:
locks: strict
root: 1.9
access list:
symbolic names:
keyword substitution: kv
total revisions: 9;    selected revisions: 9
description:
Code to demonstrate how to delete M nodes after N nodes in a single linked list in C language.
—————————-
revision 1.9    locked by: root;
date: 2014/02/20 01:52:28;  author: root;  state: Exp;  lines: +7 -1
Logical error fixed.
After deleting a node by freeing a memory using free(),the pointer is not initialized to NULL.

Status:After N nodes M nodes get deleted successfully.The program is working absolutely correctly.To check after deleting N nodes display_function is used to print the remaining nodes of the linked list.
—————————-
revision 1.8
date: 2014/02/20 01:35:38;  author: root;  state: Exp;  lines: +1 -1
After compilation,an error occurs due to pointer to a structure of type struct node is not declared.
Bug fixed.
—————————-
revision 1.7
date: 2014/02/20 01:32:15;  author: root;  state: Exp;  lines: +35 -2
delete_nodes() function is implemented.Prototype of the function is declared.The function takes 3 arguments:
1.How many nodes to delete.
2.After how many nodes to delete.
3.start node of the linked list.
Checking…………….
—————————-
revision 1.6
date: 2014/02/20 00:37:24;  author: root;  state: Exp;  lines: +11 -0
Prototype of the display_nodes() function is declared.The body of the display_nodes() function is imlemented.
Checking……..
—————————-
revision 1.5
date: 2014/02/20 00:17:08;  author: root;  state: Exp;  lines: +26 -0
insert_node() function is implemented to insert a node at the end of the linked list.
—————————-
revision 1.4
date: 2014/02/20 00:03:45;  author: root;  state: Exp;  lines: +33 -2
create_linked_list() function is implemented to create the linked list.A flag variable is used to ensure that the linked list is created just once.If the user chooses the create a linked list option next time,a message will get displayed telling the user that the linked list is already created.
—————————-
revision 1.3
date: 2014/02/19 23:47:59;  author: root;  state: Exp;  lines: +18 -0
Header file:<stdlib.h> is included to support exit() function.exit() function is used to help the user come out of the program.
—————————-
revision 1.2
date: 2014/02/19 23:44:17;  author: root;  state: Exp;  lines: +12 -1
A layout is prepared for the user.The main menu is displayed to the user each time untill the user chooses to exit the program.
—————————-
revision 1.1
date: 2014/02/19 23:39:52;  author: root;  state: Exp;
Initial revision
=============================================================================

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>