<?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>Wild pointers | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/wild-pointers/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Sat, 10 Dec 2022 04:22:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>Wild Pointer</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/wild-pointer/</link>
					<comments>https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/wild-pointer/#respond</comments>
		
		<dc:creator><![CDATA[Shubhajna Rai]]></dc:creator>
		<pubDate>Tue, 25 Oct 2022 09:03:44 +0000</pubDate>
				<category><![CDATA[C Tutorials]]></category>
		<category><![CDATA[Wild pointers]]></category>
		<category><![CDATA[Avoiding problems due to WILD pointers]]></category>
		<category><![CDATA[Dereferencing]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=9708</guid>

					<description><![CDATA[<p>Wild pointers are uninitialized pointers that point to any random position in memory while being unassigned from any other memory location. This could occasionally result in a programme crashing or acting erratically. For instance: A pointer called ptr is generated in this example, but it is empty. The pointer ptr is now a wild pointer</p>
<p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/wild-pointer/">Wild Pointer</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Wild pointers are uninitialized pointers that point to any random position in memory while being unassigned from any other memory location. This could occasionally result in a programme crashing or acting erratically.</p>



<p><strong>For instance:</strong></p>



<pre class="wp-block-code"><code lang="c" class="language-c">int *ptr;</code></pre>



<p>A pointer called ptr is generated in this example, but it is empty. The pointer ptr is now a wild pointer as a result. Declaring a pointer without initialising it has drawbacks of its own. One such drawback is that it will save any worthless information in it. It will hold in it arbitrarily a position in memory. This random allocation frequently becomes difficult for a programmer to debug, leading to several issues with the program&#8217;s operation.</p>



<p><strong>A. Avoiding problems due to WILD pointers</strong></p>



<p>In order to avoid problems that can arise while dereferencing a wild reference, we frequently opt to change a void pointer to a NULL pointer. By doing this, our pointer will instead point to a NULL position rather than any trash memory location. Simply setting a wild pointer equal to NULL will make it a NULL pointer.</p>



<p><strong>B. Dereferencing</strong></p>



<p>A wild pointer cannot be dereferenced since we are unsure of the data it is pointing at in memory. Dereferencing a wild pointer can result in numerous problems as well as a software crash.</p>



<p><strong>Example</strong>:</p>



<pre class="wp-block-code"><code lang="c" class="language-c">#include &lt;bits/stdc++.h&gt;
using namespace std;

int main() {
   int *arr;
   for(int i=0; i&lt;5 ; i++)
   cout &lt;&lt; arr[i] &lt;&lt; ” “;
   return 0;
}</code></pre>



<p><strong>Output</strong>:1 0 -426634956 32764 0</p><p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/wild-pointer/">Wild Pointer</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/wild-pointer/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
