<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dangling tool - Wikitechy</title>
	<atom:link href="https://www.wikitechy.com/interview-questions/tag/dangling-tool/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wikitechy.com/interview-questions/tag/dangling-tool/</link>
	<description>Interview Questions</description>
	<lastBuildDate>Mon, 13 Sep 2021 12:21:05 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.wikitechy.com/interview-questions/wp-content/uploads/2025/10/cropped-wikitechy-icon-32x32.png</url>
	<title>dangling tool - Wikitechy</title>
	<link>https://www.wikitechy.com/interview-questions/tag/dangling-tool/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Dangling Pointer ?</title>
		<link>https://www.wikitechy.com/interview-questions/cpp/dangling-pointer/</link>
					<comments>https://www.wikitechy.com/interview-questions/cpp/dangling-pointer/#respond</comments>
		
		<dc:creator><![CDATA[Editor]]></dc:creator>
		<pubDate>Mon, 12 Jul 2021 23:36:28 +0000</pubDate>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Accenture interview questions and answers]]></category>
		<category><![CDATA[Applied Materials interview questions and answers]]></category>
		<category><![CDATA[Atos interview questions and answers]]></category>
		<category><![CDATA[BMC Software interview questions and answers]]></category>
		<category><![CDATA[Bosch India Software interview questions and answers]]></category>
		<category><![CDATA[CASTING NETWORKS INDIA PVT LIMITED interview questions and answers]]></category>
		<category><![CDATA[Chetu interview questions and answers]]></category>
		<category><![CDATA[Ciena Corporation interview questions and answers]]></category>
		<category><![CDATA[dangling examples]]></category>
		<category><![CDATA[dangling meaning]]></category>
		<category><![CDATA[dangling memory]]></category>
		<category><![CDATA[dangling memory in c]]></category>
		<category><![CDATA[dangling pointer]]></category>
		<category><![CDATA[dangling pointer and memory leak]]></category>
		<category><![CDATA[dangling pointer definition]]></category>
		<category><![CDATA[dangling pointer example]]></category>
		<category><![CDATA[dangling pointer in c example]]></category>
		<category><![CDATA[dangling pointer in c language]]></category>
		<category><![CDATA[dangling pointer in c++]]></category>
		<category><![CDATA[dangling pointer in cmemory leak in c]]></category>
		<category><![CDATA[dangling pointer in cpp]]></category>
		<category><![CDATA[dangling pointer in data structure]]></category>
		<category><![CDATA[dangling pointer in java]]></category>
		<category><![CDATA[dangling pointer mcq]]></category>
		<category><![CDATA[dangling pointer points to]]></category>
		<category><![CDATA[dangling pointer tutorialspoint]]></category>
		<category><![CDATA[dangling reference]]></category>
		<category><![CDATA[dangling tool]]></category>
		<category><![CDATA[define dangling]]></category>
		<category><![CDATA[Dell International Services India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[eInfochips interview questions and answers]]></category>
		<category><![CDATA[Electronics Arts Inc interview questions and answers]]></category>
		<category><![CDATA[Flipkart interview questions and answers]]></category>
		<category><![CDATA[Harman International interview questions and answers]]></category>
		<category><![CDATA[how can you create a dangling pointer]]></category>
		<category><![CDATA[how to avoid dangling pointer in c]]></category>
		<category><![CDATA[Indecomm Global Services interview questions and answers]]></category>
		<category><![CDATA[Larsen & Toubro interview questions and answers]]></category>
		<category><![CDATA[Mathworks India Private Limited interview questions and answers]]></category>
		<category><![CDATA[Mavenir interview questions and answers]]></category>
		<category><![CDATA[Mphasis interview questions and answers]]></category>
		<category><![CDATA[NetApp interview questions and answers]]></category>
		<category><![CDATA[null pointer in cnull pointer c++]]></category>
		<category><![CDATA[Oracle Corporation interview questions and answers]]></category>
		<category><![CDATA[PeopleStrong interview questions and answers]]></category>
		<category><![CDATA[Philips Software Centre Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[SRM Technologies interview questions and answers]]></category>
		<category><![CDATA[Symphony Teleca interview questions and answers]]></category>
		<category><![CDATA[Tech Mahindra interview questions and answers]]></category>
		<category><![CDATA[Tecnotree interview questions and answers]]></category>
		<category><![CDATA[types of pointers in c]]></category>
		<category><![CDATA[uninitialized pointer]]></category>
		<category><![CDATA[void pointer in c]]></category>
		<category><![CDATA[what is dangling]]></category>
		<category><![CDATA[what is dangling pointer]]></category>
		<category><![CDATA[what is dangling pointer and how to avoid it]]></category>
		<category><![CDATA[what is dangling pointer in c]]></category>
		<category><![CDATA[what is dangling reference]]></category>
		<category><![CDATA[what is the meaning of dangling]]></category>
		<category><![CDATA[wild pointer in c]]></category>
		<category><![CDATA[Wipro Infotech interview questions and answers]]></category>
		<category><![CDATA[Wipro interview questions and answers]]></category>
		<category><![CDATA[Yash Technologies interview questions and answers]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=402</guid>

					<description><![CDATA[Answer : A dangling pointer is pointing to a memory location...]]></description>
										<content:encoded><![CDATA[<div class="TextHeading">
<div class="hddn">
<h2 id="dangling-pointer" class="color-pink" style="text-align: justify;">Dangling Pointer</h2>
</div>
</div>
<div class="Content">
<div class="hddn" style="text-align: justify;">
<ul>
<li>A dangling pointer is pointing to a memory location that has been deleted (or freed). The dangling pointer act as a different ways there are,
<ul>
<li>De-allocation of memory</li>
<li>Function Call</li>
<li>Variable goes out of scope</li>
</ul>
</li>
</ul>
</div>
<div class="ImageContent" style="text-align: justify;">
<div class="hddn"><img decoding="async" class="img-responsive center-block aligncenter" src="https://cdn.wikitechy.com/interview-questions/cpp/dangling-pointers.png" alt=" " /></div>
</div>
<div class="TextHeading">
<div class="hddn">
<h2 id="de-allocation-of-memory" class="color-blue" style="text-align: justify;">De-allocation of memory</h2>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-cpp code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-cpp code-embed-code">#include&lt;stdlib.h&gt;<br/>void main()<br/>{<br/>    char *ptr = malloc(Constant_Value);<br/>    free (ptr); //ptr now becomes a dangling pointer<br/>}</code></pre> </div>
<ul style="text-align: justify;">
<li>First we have declared in the character pointer. After execution of some statements we have de-allocated memory which is allocated previously for the pointer.</li>
<li>Immediately memory is de-allocated for pointer, pointer becomes dangling pointer.</li>
</ul>
<h2 id="function-call" class="color-blue" style="text-align: justify;">Function Call</h2>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-cpp code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-cpp code-embed-code">int * func ( void )<br/>{<br/>    int num = 14;<br/>    return #<br/>}</code></pre> </div>
<ul style="text-align: justify;">
<li>The pointer may be return the correct value (1234) for a while after calling <b>func</b>, but any functions called thereafter will overwrite the stack storage allocated for <b>num</b> with other values and the pointer would no longer work correctly.</li>
<li>If a pointer to num must be returned, num must have scope beyond the function it might be declared as static.</li>
</ul>
<h2 id="variable-goes-out-of-scope" class="color-blue" style="text-align: justify;">Variable goes out of scope</h2>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-cpp code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-cpp code-embed-code">#include&lt;stdlib.h&gt;<br/>void main()<br/>{<br/>    char *ptr = NULL;<br/>    {<br/>        char ch;<br/>        ptr = &amp;ch;<br/>    }//dp is now a dangling pointer<br/>}</code></pre> </div>
<ul style="text-align: justify;">
<li>First we have declared in the Character Pointer.</li>
<li>Next the Pointer Variable ‘ptr’ is pointing to Character Variable ‘ch’ declared in the inner block .</li>
<li>As character variable is non-visible in Outer Block , then Pointer is still pointing to Same Invalid memory location in Outer block , then Pointer becomes “Dangling”.</li>
</ul>
<p style="text-align: justify;">
</div>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/cpp/dangling-pointer/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
