SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Linked LIST
• A linked list is a linear and a non-primitive
data structure in which each element is
allocated dynamically, and each element
points to the next element.
• In other words, we can say that it is a data
structure consisting of a group of nodes that
concurrently represent a sequence.
S.No. ARRAY LINKED LIST
1.
An array is a grouping of data elements of
equivalent data type.
A linked list is a group of entities called a
node. The node includes two segments:
data and address.
2.
It stores the data elements in a
contiguous memory zone.
It stores elements randomly, or we can say
anywhere in the memory zone.
3.
In the case of an array, memory size is
fixed, and it is not possible to change it
during the run time.
In the linked list, the placement of
elements is allocated during the run time.
4.
The elements are not dependent on each
other.
The data elements are dependent on each
other.
5. The memory is assigned at compile time. The memory is assigned at run time.
6.
It is easier and faster to access the
element in an array.
In a linked list, the process of accessing
elements takes more time.
7.
In the case of an array, memory utilization
is ineffective.
In the case of the linked list, memory
utilization is effective.
8
When it comes to executing any operation
like insertion, deletion, array takes more
time.
When it comes to executing any operation
like insertion, deletion, the linked list takes
less time.
Types of Linked Lists:
Simple Linked List
Doubly Linked List
Circular Linked List
Doubly Circular Linked List
Header Linked List
A header linked list is a special type of linked list that contains a header node at
the beginning of the list.
Simple Linked List – In this type of linked list, one can move or traverse the
linked list in only one direction. where the next pointer of each node points to
other nodes but the next pointer of the last node points to NULL. It is also
called “Singly Linked List”.
Doubly Linked List – In this type of linked list, one can move or traverse the
linked list in both directions (Forward and Backward)
Circular Linked List – In this type of linked list, the last node of the linked list
contains the link of the first/head node of the linked list in its next pointer.
Doubly Circular Linked List – A Doubly Circular linked list or a circular two-way
linked list is a more complex type of linked list that contains a pointer to the
next as well as the previous node in the sequence.
. The difference between the doubly linked and circular doubly list is the same as that
between a singly linked list and a circular linked list.
The circular doubly linked list does not contain null in the previous field of the first
node.
• A linked list is a way to store a collection of
elements.
• Each element in a linked list is stored in the
form of a node.
• A node is a collection of two sub-elements or
parts.
– A data part that stores the element
– next part that stores the link to the next node
Declaring a Linked list :
a linked list can be implemented using structure and
pointers .
struct LinkedList
{
int data;
struct LinkedList *next;
};
The above definition is used to create every node in the
list.
– The data field stores the element
– the next is a pointer to store the address of the next node.
struct LinkedList
{
int data;
struct LinkedList *next;
};
In place of a data type, struct LinkedList is written before next.
That's because its a self-referencing pointer. It means a pointer
that points to whatever it is a part of.
Here next is a part of a node and it will point to the next node.
13
MEMORY ALLOCATION PROCESS
The program instructions, global and static variables are stored in a region known as
permanent storage area.
Local variables are stored in another region called stack.
The memory spaced located between stack and permanent storage area is available
for dynamic memory allocation during execution of the program. This free memory region is
called as heap.
14
The memory allocation may be classified as
static memory allocation and dynamic memory
allocation.
Static memory allocation: Memory for the variables
is created at the time of compilation is known as static
memory.
Dynamic memory allocation: Memory for the
variables is allocated at the time of execution of the
program is called dynamic memory.
15
Dynamic memory allocation functions are
defined in stdlib.h and alloc.h header files.
1. malloc()
2. calloc()
3. realloc()
4. free()
malloc(), calloc() and realloc() are memory
allocation functions and free() is a memory releasing
function.
16
1. malloc() function:
malloc() function is used to allocate memory for the
variables at run time.
Syntax: prtvariable = (casttype*)malloc(size);
Where,
ptrvariable is a pointer variable of type casttype.
size represents number of bytes of memory to be
allocated.
17
Example: int *X;
X = (int*)malloc(5*2); (or)
X = (int*)malloc(5*sizeof(int));
Here, malloc() function reserves a single block of
memory with the specified size and returns a pointer of type
void. With this, we can assign it to any type of pointer
variable. By default memory location is filled with garbage
values.
Creating a Node:
typedef is used to define a data type in C.
malloc() is used to dynamically allocate a single block of memory in C, it is
available in the header file stdlib.h.
sizeof() is used to determine size in bytes of an element in C. Here it is
used to determine size of each node and sent as a parameter to malloc.
The above code will create a node with data as value and next pointing to
NULL.

Weitere ähnliche Inhalte

Ähnlich wie linked list.pptx

1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptxssuserd2f031
 
LINKED LIST.pptx
LINKED LIST.pptxLINKED LIST.pptx
LINKED LIST.pptxDr.Shweta
 
Notes of bca Question paper for exams and tests
Notes of bca Question paper for exams and testsNotes of bca Question paper for exams and tests
Notes of bca Question paper for exams and testspriyanshukumar97908
 
Data Structures(Part 1)
Data Structures(Part 1)Data Structures(Part 1)
Data Structures(Part 1)SURBHI SAROHA
 
CS8391-DATA-STRUCTURES.pdf
CS8391-DATA-STRUCTURES.pdfCS8391-DATA-STRUCTURES.pdf
CS8391-DATA-STRUCTURES.pdfraji175286
 
ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfKamranAli649587
 
2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdfSulabhPawaia
 
Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data StructureJazz Jinia Bhowmik
 
2 Important Data Structure Interview Questions
2 Important Data Structure Interview Questions2 Important Data Structure Interview Questions
2 Important Data Structure Interview QuestionsGeekster
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
DLL DATA STRUCT.pptx
DLL DATA STRUCT.pptxDLL DATA STRUCT.pptx
DLL DATA STRUCT.pptxMuwaffiqa
 
Linear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and QueueLinear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and QueueSelvaraj Seerangan
 

Ähnlich wie linked list.pptx (20)

Link list
Link listLink list
Link list
 
Linked List
Linked ListLinked List
Linked List
 
Lecture 2b lists
Lecture 2b listsLecture 2b lists
Lecture 2b lists
 
1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptx
 
LINKED LIST.pptx
LINKED LIST.pptxLINKED LIST.pptx
LINKED LIST.pptx
 
Notes of bca Question paper for exams and tests
Notes of bca Question paper for exams and testsNotes of bca Question paper for exams and tests
Notes of bca Question paper for exams and tests
 
Data structure
 Data structure Data structure
Data structure
 
Linkedlists
LinkedlistsLinkedlists
Linkedlists
 
Data Structures(Part 1)
Data Structures(Part 1)Data Structures(Part 1)
Data Structures(Part 1)
 
CS8391-DATA-STRUCTURES.pdf
CS8391-DATA-STRUCTURES.pdfCS8391-DATA-STRUCTURES.pdf
CS8391-DATA-STRUCTURES.pdf
 
Linked list (1).pptx
Linked list (1).pptxLinked list (1).pptx
Linked list (1).pptx
 
ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdf
 
Link list
Link listLink list
Link list
 
2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf
 
Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data Structure
 
2 Important Data Structure Interview Questions
2 Important Data Structure Interview Questions2 Important Data Structure Interview Questions
2 Important Data Structure Interview Questions
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
DLL DATA STRUCT.pptx
DLL DATA STRUCT.pptxDLL DATA STRUCT.pptx
DLL DATA STRUCT.pptx
 
Linear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and QueueLinear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and Queue
 
unit 1.pptx
unit 1.pptxunit 1.pptx
unit 1.pptx
 

Kürzlich hochgeladen

SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 

Kürzlich hochgeladen (20)

SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 

linked list.pptx

  • 1. Linked LIST • A linked list is a linear and a non-primitive data structure in which each element is allocated dynamically, and each element points to the next element. • In other words, we can say that it is a data structure consisting of a group of nodes that concurrently represent a sequence.
  • 2.
  • 3. S.No. ARRAY LINKED LIST 1. An array is a grouping of data elements of equivalent data type. A linked list is a group of entities called a node. The node includes two segments: data and address. 2. It stores the data elements in a contiguous memory zone. It stores elements randomly, or we can say anywhere in the memory zone. 3. In the case of an array, memory size is fixed, and it is not possible to change it during the run time. In the linked list, the placement of elements is allocated during the run time. 4. The elements are not dependent on each other. The data elements are dependent on each other. 5. The memory is assigned at compile time. The memory is assigned at run time. 6. It is easier and faster to access the element in an array. In a linked list, the process of accessing elements takes more time. 7. In the case of an array, memory utilization is ineffective. In the case of the linked list, memory utilization is effective. 8 When it comes to executing any operation like insertion, deletion, array takes more time. When it comes to executing any operation like insertion, deletion, the linked list takes less time.
  • 4. Types of Linked Lists: Simple Linked List Doubly Linked List Circular Linked List Doubly Circular Linked List Header Linked List A header linked list is a special type of linked list that contains a header node at the beginning of the list.
  • 5. Simple Linked List – In this type of linked list, one can move or traverse the linked list in only one direction. where the next pointer of each node points to other nodes but the next pointer of the last node points to NULL. It is also called “Singly Linked List”.
  • 6. Doubly Linked List – In this type of linked list, one can move or traverse the linked list in both directions (Forward and Backward)
  • 7. Circular Linked List – In this type of linked list, the last node of the linked list contains the link of the first/head node of the linked list in its next pointer.
  • 8. Doubly Circular Linked List – A Doubly Circular linked list or a circular two-way linked list is a more complex type of linked list that contains a pointer to the next as well as the previous node in the sequence. . The difference between the doubly linked and circular doubly list is the same as that between a singly linked list and a circular linked list. The circular doubly linked list does not contain null in the previous field of the first node.
  • 9. • A linked list is a way to store a collection of elements. • Each element in a linked list is stored in the form of a node. • A node is a collection of two sub-elements or parts. – A data part that stores the element – next part that stores the link to the next node
  • 10.
  • 11. Declaring a Linked list : a linked list can be implemented using structure and pointers . struct LinkedList { int data; struct LinkedList *next; }; The above definition is used to create every node in the list. – The data field stores the element – the next is a pointer to store the address of the next node.
  • 12. struct LinkedList { int data; struct LinkedList *next; }; In place of a data type, struct LinkedList is written before next. That's because its a self-referencing pointer. It means a pointer that points to whatever it is a part of. Here next is a part of a node and it will point to the next node.
  • 13. 13 MEMORY ALLOCATION PROCESS The program instructions, global and static variables are stored in a region known as permanent storage area. Local variables are stored in another region called stack. The memory spaced located between stack and permanent storage area is available for dynamic memory allocation during execution of the program. This free memory region is called as heap.
  • 14. 14 The memory allocation may be classified as static memory allocation and dynamic memory allocation. Static memory allocation: Memory for the variables is created at the time of compilation is known as static memory. Dynamic memory allocation: Memory for the variables is allocated at the time of execution of the program is called dynamic memory.
  • 15. 15 Dynamic memory allocation functions are defined in stdlib.h and alloc.h header files. 1. malloc() 2. calloc() 3. realloc() 4. free() malloc(), calloc() and realloc() are memory allocation functions and free() is a memory releasing function.
  • 16. 16 1. malloc() function: malloc() function is used to allocate memory for the variables at run time. Syntax: prtvariable = (casttype*)malloc(size); Where, ptrvariable is a pointer variable of type casttype. size represents number of bytes of memory to be allocated.
  • 17. 17 Example: int *X; X = (int*)malloc(5*2); (or) X = (int*)malloc(5*sizeof(int)); Here, malloc() function reserves a single block of memory with the specified size and returns a pointer of type void. With this, we can assign it to any type of pointer variable. By default memory location is filled with garbage values.
  • 18. Creating a Node: typedef is used to define a data type in C. malloc() is used to dynamically allocate a single block of memory in C, it is available in the header file stdlib.h. sizeof() is used to determine size in bytes of an element in C. Here it is used to determine size of each node and sent as a parameter to malloc. The above code will create a node with data as value and next pointing to NULL.