<?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>operations on pointers | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/operations-on-pointers/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Thu, 29 Dec 2022 14:03:50 +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>Operations on Pointers-Part II</title>
		<link>https://studentprojects.in/software-development/cpp/operations-on-pointers-part-ii/</link>
					<comments>https://studentprojects.in/software-development/cpp/operations-on-pointers-part-ii/#respond</comments>
		
		<dc:creator><![CDATA[Shubhajna Rai]]></dc:creator>
		<pubDate>Sun, 01 Jan 2023 02:10:00 +0000</pubDate>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[operations on pointers]]></category>
		<category><![CDATA[pointer to pointer]]></category>
		<category><![CDATA[arrays and pointers]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=10059</guid>

					<description><![CDATA[<p>Pointer to Pointer Pointer to Pointer is a straightforward idea in which we store the address of one pointer to another. Because of the operator&#8217;s name, this is also known as numerous indirections. The first pointer carries the location of the second pointer, which points to the address where the value of the real variable</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/operations-on-pointers-part-ii/">Operations on Pointers-Part II</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<h3>Pointer to Pointer</h3>



<p>Pointer to Pointer is a straightforward idea in which we store the address of one pointer to another. Because of the operator&#8217;s name, this is also known as numerous indirections. The first pointer carries the location of the second pointer, which points to the address where the value of the real variable is kept.</p>



<p>An example of how to define a pointer to a pointer.</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">#include &lt;iostream&gt;
using namespace std;
 
int main()
{
    int a = 100;
    int *b = &amp;a;
    int **c = &amp;b;
    cout &lt;&lt; "Value of variable a is " &lt;&lt; a &lt;&lt; endl;
    cout &lt;&lt; "Address of variable a is " &lt;&lt; b &lt;&lt; endl;
    cout &lt;&lt; "Address of pointer b is " &lt;&lt; c &lt;&lt; endl;
    return 0;
}
</code></pre>



<p>Output:</p>



<p>Value of variable a is 100</p>



<p>Address of variable a is 0x61feb8</p>



<p>Address of pointer b is 0x61feb4</p>



<h3>Arrays and Pointers</h3>



<p>Storing an array&#8217;s address into a pointer differs from storing a variable&#8217;s address into a pointer. The name of an array is the address of the array&#8217;s first index. As a result, using the (ampersand)&amp; operator with the array name to assign an address to a pointer is incorrect. Instead, we used the array&#8217;s name.An example programme for saving the array&#8217;s initial address in the pointer,</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">#include &lt;iostream&gt;
using namespace std;
 
int main()
{
    int a = 10;
    cout &lt;&lt; "Address of variable a is " &lt;&lt; &amp;a &lt;&lt; endl;
    return 0;
}
</code></pre>



<p>Output:</p>



<p>The value of marks[0] is 99</p>



<p>We can utilise pointer arithmetic, such as addition and subtraction of pointers, to access other items of the same array that pointer p points to.</p>



<p>*(p+1) returns the value in the array&#8217;s second position. This is how it works:</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">int marks[] = {99, 100, 38};
int *p = marks;
cout &lt;&lt; "The value of marks[0] is " &lt;&lt; *p &lt;&lt; endl;
cout &lt;&lt; "The value of marks[1] is " &lt;&lt; *(p + 1) &lt;&lt; endl;
cout &lt;&lt; "The value of marks[2] is " &lt;&lt; *(p + 2) &lt;&lt; endl;</code></pre>



<p>output:</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">The value of marks[0] is 99
The value of marks[1] is 100
The value of marks[2] is 38
</code></pre><p>The post <a href="https://studentprojects.in/software-development/cpp/operations-on-pointers-part-ii/">Operations on Pointers-Part II</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/operations-on-pointers-part-ii/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Operations on Pointers-Part I</title>
		<link>https://studentprojects.in/software-development/cpp/operations-on-pointers-part-i/</link>
					<comments>https://studentprojects.in/software-development/cpp/operations-on-pointers-part-i/#respond</comments>
		
		<dc:creator><![CDATA[Shubhajna Rai]]></dc:creator>
		<pubDate>Sat, 31 Dec 2022 02:03:00 +0000</pubDate>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[operations on pointers]]></category>
		<category><![CDATA[address of operators]]></category>
		<category><![CDATA[Indirection operator]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=10055</guid>

					<description><![CDATA[<p>Address of Operator (&#38;): &#38; is sometimes referred to as the Referencing Operator. It&#8217;s a one-of-a-kind operator. The variable name that is used in conjunction with the Address of operator must be the name of a previously declared variable. Using the &#38; operator with a variable returns the variable&#8217;s address number. Here&#8217;s an example of</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/operations-on-pointers-part-i/">Operations on Pointers-Part I</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<h3>Address of Operator (&amp;):</h3>



<p>&amp; is sometimes referred to as the Referencing Operator. It&#8217;s a one-of-a-kind operator. The variable name that is used in conjunction with the Address of operator must be the name of a previously declared variable.</p>



<p>Using the &amp; operator with a variable returns the variable&#8217;s address number.</p>



<p>Here&#8217;s an example of how the operator&#8217;s address can be used.</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">#include &lt;iostream&gt;
using namespace std;
 
int main()
{
    int a = 10;
    cout &lt;&lt; "Address of variable a is " &lt;&lt; &amp;a &lt;&lt; endl;
    return 0;
}
</code></pre>



<p>Output:</p>



<p>0x61febc</p>



<h3>The Indirection Operator</h3>



<p>&nbsp;* is also known as the Dereferencing Operator. It is a unary operator. It takes an address as an argument and returns the content/container whose address is the argument.</p>



<p>Here&#8217;s one example of how to utilise the indirection operator.</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">#include &lt;iostream&gt;
using namespace std;
 
int main()
{
    int a = 100;
    cout &lt;&lt; "Value of variable a stored at address " &lt;&lt; &amp;a &lt;&lt; " is " &lt;&lt; (*(&amp;a)) &lt;&lt; endl;
    return 0;
}
</code></pre>



<p>Output</p>



<p>Value of variable a stored at address 0x61febc is 100</p><p>The post <a href="https://studentprojects.in/software-development/cpp/operations-on-pointers-part-i/">Operations on Pointers-Part I</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/operations-on-pointers-part-i/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Operations on Pointers</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/operations-on-pointers/</link>
					<comments>https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/operations-on-pointers/#respond</comments>
		
		<dc:creator><![CDATA[Shubhajna Rai]]></dc:creator>
		<pubDate>Tue, 25 Oct 2022 08:54:26 +0000</pubDate>
				<category><![CDATA[C Tutorials]]></category>
		<category><![CDATA[operator ++]]></category>
		<category><![CDATA[operations on pointers]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=9699</guid>

					<description><![CDATA[<p>Operator (&#38;) address: This operator is a unary operator.Operand must be the name of a variable that has previously been defined.The variable&#8217;s address number is provided by the &#38; operator.&#38; is likewise referred to as the &#8220;Referencing Operator.&#8221; Here is an illustration of how to use the operator&#8217;s address. Output: 100 Address of variable a</p>
<p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/operations-on-pointers/">Operations on Pointers</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Operator (&amp;) address: This operator is a unary operator.Operand must be the name of a variable that has previously been defined.The variable&#8217;s address number is provided by the &amp; operator.&amp; is likewise referred to as the &#8220;Referencing Operator.&#8221;</p>



<p>Here is an illustration of how to use the operator&#8217;s address.</p>



<pre class="wp-block-code"><code lang="c" class="language-c">#include &lt;stdio.h&gt; 
int main()
{
    int a = 100;
    printf("%d\n", a);
    printf("Address of variable a is %d", &amp;a);
    return 0;
}</code></pre>



<p>Output: 100</p>



<p>Address of variable a is 6422220</p>



<p><strong>Operator for indirection (*):</strong></p>



<p>The operator for indirection is *.Another name for it is the &#8220;Dereferencing Operator.&#8221;The operator is also unary.It uses an address as a justification.* returns the content or container whose argument is its argument&#8217;s address.</p>



<pre class="wp-block-code"><code class="">#include &lt;stdio.h&gt;
int main()
{
    int a = 100;
    printf("Value of variable a stored at address %d is %d.", &amp;a, *(&amp;a));
    return 0;
}</code></pre>



<p>Output: Value of variable a stored at address 6422220 is 100.</p><p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c-tutorials-c-tutorials/operations-on-pointers/">Operations on Pointers</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/operations-on-pointers/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
