A node can be inserted into the list either before the first node (so that the new node becomes the first node) or in between anywhere in the list. If we write a function to insert, we will need the information as to where the node is to be inserted, by accepting an e_no, before which the node is to be inserted.
code snippet for insertion of node
A new pointer defined, newrecord. New employee number is accepted. Target is assigned the value of e_no before which new node is to be inserted.
If target is 1 and new e_no = 7, then new node is to be inserted at the beginning of the list as shown diagrammatically.
If target is 8 and new e_no = 7, then newrecord node is be inserted before node whose e_ no = 8. The function locate, locates the node before the target node and returns a pointer to it.
C Related Interview Questions
|DBMS Interview Questions||C++ Interview Questions|
|C & Data Structures Interview Questions||Java Interview Questions|
|Go (programming language) Interview Questions||F Sharp (programming language) Interview Questions|
|C preprocessor Interview Questions||R Programming language Interview Questions|
|D Programming Language Interview Questions||Lua (programming language) Interview Questions|
|Embedded C Interview Questions|
Introduction To C-programming
Data Types And Storage Classes
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.