SlideShare a Scribd company logo
1 of 1
Download to read offline
What is the dangling pointer? Explain with a proper example.
Solution
A dangling pointer is a pointer which nce pointed to some data, but because of memory
deallocation, points to an invalid or null data.
Example:
Suppose we declare and allocate some memory to a pointer:
char *temp = malloc(some_size);
Then we de-allocate the memory allocated to the pointer temp by,
free (temp);
After execution of the above statement, temp becomes a dangling pointer.

More Related Content

More from arishmarketing21

The organization of interrupted genes is often conserved between spe.pdf
The organization of interrupted genes is often conserved between spe.pdfThe organization of interrupted genes is often conserved between spe.pdf
The organization of interrupted genes is often conserved between spe.pdf
arishmarketing21
 
Resistance A primitive adaptive immune Zone of inhibition The ability.pdf
Resistance A primitive adaptive immune Zone of inhibition The ability.pdfResistance A primitive adaptive immune Zone of inhibition The ability.pdf
Resistance A primitive adaptive immune Zone of inhibition The ability.pdf
arishmarketing21
 
Refer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdfRefer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdf
arishmarketing21
 
Q1) Show what part of SSL that protects against the following attack.pdf
Q1) Show what part of SSL that protects against the following attack.pdfQ1) Show what part of SSL that protects against the following attack.pdf
Q1) Show what part of SSL that protects against the following attack.pdf
arishmarketing21
 
public class Patient extends Person {=========== Properties ====.pdf
public class Patient extends Person {=========== Properties ====.pdfpublic class Patient extends Person {=========== Properties ====.pdf
public class Patient extends Person {=========== Properties ====.pdf
arishmarketing21
 
please help with java questionsJAVA CODEplease check my code and.pdf
please help with java questionsJAVA CODEplease check my code and.pdfplease help with java questionsJAVA CODEplease check my code and.pdf
please help with java questionsJAVA CODEplease check my code and.pdf
arishmarketing21
 
Please make sure you write about Republic of Turkey otherwise please.pdf
Please make sure you write about Republic of Turkey otherwise please.pdfPlease make sure you write about Republic of Turkey otherwise please.pdf
Please make sure you write about Republic of Turkey otherwise please.pdf
arishmarketing21
 
Ontologies are useful because they Systemize the many existing param.pdf
Ontologies are useful because they  Systemize the many existing param.pdfOntologies are useful because they  Systemize the many existing param.pdf
Ontologies are useful because they Systemize the many existing param.pdf
arishmarketing21
 
Nervous system intro, neurons Branches of nervous system (generally .pdf
Nervous system intro, neurons  Branches of nervous system (generally .pdfNervous system intro, neurons  Branches of nervous system (generally .pdf
Nervous system intro, neurons Branches of nervous system (generally .pdf
arishmarketing21
 

More from arishmarketing21 (20)

Using the man command, determine which ls command option (flag) will.pdf
Using the man command, determine which ls command option (flag) will.pdfUsing the man command, determine which ls command option (flag) will.pdf
Using the man command, determine which ls command option (flag) will.pdf
 
There a six seats in a bar. Your friend took the second seat from th.pdf
There a six seats in a bar. Your friend took the second seat from th.pdfThere a six seats in a bar. Your friend took the second seat from th.pdf
There a six seats in a bar. Your friend took the second seat from th.pdf
 
The basic economic problem is that we only have so many resources, b.pdf
The basic  economic problem is that we only have so many resources, b.pdfThe basic  economic problem is that we only have so many resources, b.pdf
The basic economic problem is that we only have so many resources, b.pdf
 
The organization of interrupted genes is often conserved between spe.pdf
The organization of interrupted genes is often conserved between spe.pdfThe organization of interrupted genes is often conserved between spe.pdf
The organization of interrupted genes is often conserved between spe.pdf
 
The daisy has which inflorescence morphology type campanulte tubul.pdf
The daisy has which inflorescence morphology type  campanulte  tubul.pdfThe daisy has which inflorescence morphology type  campanulte  tubul.pdf
The daisy has which inflorescence morphology type campanulte tubul.pdf
 
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdfSuppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
 
Resistance A primitive adaptive immune Zone of inhibition The ability.pdf
Resistance A primitive adaptive immune Zone of inhibition The ability.pdfResistance A primitive adaptive immune Zone of inhibition The ability.pdf
Resistance A primitive adaptive immune Zone of inhibition The ability.pdf
 
Refer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdfRefer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdf
 
Q1) Show what part of SSL that protects against the following attack.pdf
Q1) Show what part of SSL that protects against the following attack.pdfQ1) Show what part of SSL that protects against the following attack.pdf
Q1) Show what part of SSL that protects against the following attack.pdf
 
public class Patient extends Person {=========== Properties ====.pdf
public class Patient extends Person {=========== Properties ====.pdfpublic class Patient extends Person {=========== Properties ====.pdf
public class Patient extends Person {=========== Properties ====.pdf
 
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
 
please help with java questionsJAVA CODEplease check my code and.pdf
please help with java questionsJAVA CODEplease check my code and.pdfplease help with java questionsJAVA CODEplease check my code and.pdf
please help with java questionsJAVA CODEplease check my code and.pdf
 
Please make sure you write about Republic of Turkey otherwise please.pdf
Please make sure you write about Republic of Turkey otherwise please.pdfPlease make sure you write about Republic of Turkey otherwise please.pdf
Please make sure you write about Republic of Turkey otherwise please.pdf
 
PAHTOLOGY! the rates of social anxiety disorder have increased over .pdf
PAHTOLOGY! the rates of social anxiety disorder have increased over .pdfPAHTOLOGY! the rates of social anxiety disorder have increased over .pdf
PAHTOLOGY! the rates of social anxiety disorder have increased over .pdf
 
Ontologies are useful because they Systemize the many existing param.pdf
Ontologies are useful because they  Systemize the many existing param.pdfOntologies are useful because they  Systemize the many existing param.pdf
Ontologies are useful because they Systemize the many existing param.pdf
 
Nervous system intro, neurons Branches of nervous system (generally .pdf
Nervous system intro, neurons  Branches of nervous system (generally .pdfNervous system intro, neurons  Branches of nervous system (generally .pdf
Nervous system intro, neurons Branches of nervous system (generally .pdf
 
Mr. Rossi, a fisherman in his late sixties, comes to the clinic to c.pdf
Mr. Rossi, a fisherman in his late sixties, comes to the clinic to c.pdfMr. Rossi, a fisherman in his late sixties, comes to the clinic to c.pdf
Mr. Rossi, a fisherman in his late sixties, comes to the clinic to c.pdf
 
Jim produces and sells $1100 worth of flowers. Jim uses no intermedi.pdf
Jim produces and sells $1100 worth of flowers. Jim uses no intermedi.pdfJim produces and sells $1100 worth of flowers. Jim uses no intermedi.pdf
Jim produces and sells $1100 worth of flowers. Jim uses no intermedi.pdf
 
How will you choose to contribute to the public good over not contri.pdf
How will you choose to contribute to the public good over not contri.pdfHow will you choose to contribute to the public good over not contri.pdf
How will you choose to contribute to the public good over not contri.pdf
 
James Hutton and Charles Lyell were geologists whose ideas strongly i.pdf
James Hutton and Charles Lyell were geologists whose ideas strongly i.pdfJames Hutton and Charles Lyell were geologists whose ideas strongly i.pdf
James Hutton and Charles Lyell were geologists whose ideas strongly i.pdf
 

Recently uploaded

Recently uploaded (20)

Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food Additives
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use Cases
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 

What is the dangling pointer Explain with a proper example.Solut.pdf

  • 1. What is the dangling pointer? Explain with a proper example. Solution A dangling pointer is a pointer which nce pointed to some data, but because of memory deallocation, points to an invalid or null data. Example: Suppose we declare and allocate some memory to a pointer: char *temp = malloc(some_size); Then we de-allocate the memory allocated to the pointer temp by, free (temp); After execution of the above statement, temp becomes a dangling pointer.