<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: 7.4 &#8212; Passing arguments by address</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/74-passing-arguments-by-address/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/74-passing-arguments-by-address/</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2012 12:30:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: &#34;gas card&#34; system, passing structures to functions(need help)</title>
		<link>http://www.learncpp.com/cpp-tutorial/74-passing-arguments-by-address/comment-page-1/#comment-96792</link>
		<dc:creator>&#34;gas card&#34; system, passing structures to functions(need help)</dc:creator>
		<pubDate>Fri, 06 Jan 2012 15:41:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/74-passing-arguments-by-address/#comment-96792</guid>
		<description>[...] the documentation for printf() and scanf(). You may also want to review Pointers and maybe Passing arguments.  [...]</description>
		<content:encoded><![CDATA[<p>[...] the documentation for printf() and scanf(). You may also want to review Pointers and maybe Passing arguments.  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: moon1212</title>
		<link>http://www.learncpp.com/cpp-tutorial/74-passing-arguments-by-address/comment-page-1/#comment-96596</link>
		<dc:creator>moon1212</dc:creator>
		<pubDate>Sat, 10 Dec 2011 17:48:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/74-passing-arguments-by-address/#comment-96596</guid>
		<description>•	Q.1 write a the c program using a function method to calculation the area and perimeter for the rectangle and the square by any given width and height . the program should ask the user to stop or retry the program with other values .       


Q.2 write a program in c language using a function method to calculate the following series and give the result;
X= n^1*n^2*n^3*…………* n^k
Where n&amp;k are any number given by the user
pls… help me</description>
		<content:encoded><![CDATA[<p>•	Q.1 write a the c program using a function method to calculation the area and perimeter for the rectangle and the square by any given width and height . the program should ask the user to stop or retry the program with other values .       </p>
<p>Q.2 write a program in c language using a function method to calculate the following series and give the result;<br />
X= n^1*n^2*n^3*…………* n^k<br />
Where n&amp;k are any number given by the user<br />
pls… help me</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://www.learncpp.com/cpp-tutorial/74-passing-arguments-by-address/comment-page-1/#comment-95812</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Sun, 31 Jul 2011 22:59:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/74-passing-arguments-by-address/#comment-95812</guid>
		<description>I just found out that you have to pass arrays to functions as pointers.</description>
		<content:encoded><![CDATA[<p>I just found out that you have to pass arrays to functions as pointers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://www.learncpp.com/cpp-tutorial/74-passing-arguments-by-address/comment-page-1/#comment-95811</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Sun, 31 Jul 2011 22:48:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/74-passing-arguments-by-address/#comment-95811</guid>
		<description>&quot;pnArray[ii]&quot; doesn&#039;t need to be dereferenced because when using the square brackets C++ implicitly does any pointer addition needed and dereferences the variable which Alex showed in an earlier tutorial.</description>
		<content:encoded><![CDATA[<p>&#8220;pnArray[ii]&#8221; doesn&#8217;t need to be dereferenced because when using the square brackets C++ implicitly does any pointer addition needed and dereferences the variable which Alex showed in an earlier tutorial.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hungma</title>
		<link>http://www.learncpp.com/cpp-tutorial/74-passing-arguments-by-address/comment-page-1/#comment-95180</link>
		<dc:creator>hungma</dc:creator>
		<pubDate>Sun, 13 Feb 2011 17:30:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/74-passing-arguments-by-address/#comment-95180</guid>
		<description>i think it is the overloaded operator.you can research it.Fun!</description>
		<content:encoded><![CDATA[<p>i think it is the overloaded operator.you can research it.Fun!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: moosefetcher</title>
		<link>http://www.learncpp.com/cpp-tutorial/74-passing-arguments-by-address/comment-page-1/#comment-95110</link>
		<dc:creator>moosefetcher</dc:creator>
		<pubDate>Wed, 19 Jan 2011 10:20:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/74-passing-arguments-by-address/#comment-95110</guid>
		<description>Hello there.
I&#039;m new to C++ (as will soon become obvious!), and I don&#039;t understand why the following function (the second block of code on the tutorial above) prints the CONTENTS of pnArray...

void PrintArray(int *pnArray, int nLength)
{
    for (int iii=0; iii &lt; nLength; iii++)
        cout &lt;&lt; pnArray[iii] &lt;&lt; endl;
}

Shouldn&#039;t the &#039;pnArray[iii]&#039; part be dereferenced (ie; &#039;*pnArray[iii]&#039;)to get the values IN the pointer array? Or does it not work like that with pointer arrays? Clearly there&#039;s something I&#039;m not getting!
Any help, well appreciated.
Thanks for all the great tutorials. You have a great way of explaining concepts step by step!</description>
		<content:encoded><![CDATA[<p>Hello there.<br />
I&#8217;m new to C++ (as will soon become obvious!), and I don&#8217;t understand why the following function (the second block of code on the tutorial above) prints the CONTENTS of pnArray&#8230;</p>
<p>void PrintArray(int *pnArray, int nLength)<br />
{<br />
    for (int iii=0; iii &lt; nLength; iii++)<br />
        cout &lt;&lt; pnArray[iii] &lt;&lt; endl;<br />
}</p>
<p>Shouldn&#039;t the &#039;pnArray[iii]&#039; part be dereferenced (ie; &#039;*pnArray[iii]&#039;)to get the values IN the pointer array? Or does it not work like that with pointer arrays? Clearly there&#039;s something I&#039;m not getting!<br />
Any help, well appreciated.<br />
Thanks for all the great tutorials. You have a great way of explaining concepts step by step!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prashant wavkhede</title>
		<link>http://www.learncpp.com/cpp-tutorial/74-passing-arguments-by-address/comment-page-1/#comment-93662</link>
		<dc:creator>prashant wavkhede</dc:creator>
		<pubDate>Wed, 13 Oct 2010 19:23:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/74-passing-arguments-by-address/#comment-93662</guid>
		<description>write a function power  to return x to power y, if arguments are (x,y)     and to return square of x if argument is (x).</description>
		<content:encoded><![CDATA[<p>write a function power  to return x to power y, if arguments are (x,y)     and to return square of x if argument is (x).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rebelsoul</title>
		<link>http://www.learncpp.com/cpp-tutorial/74-passing-arguments-by-address/comment-page-1/#comment-92133</link>
		<dc:creator>rebelsoul</dc:creator>
		<pubDate>Thu, 16 Sep 2010 12:19:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/74-passing-arguments-by-address/#comment-92133</guid>
		<description>I have found the problem and it was that i was passing address of a variable in my function call e.g.
&lt;pre&gt; SetToSix(nTvalue)
instead of 
SetToSix(pPtr);
 &lt;/pre&gt;

However, still i am getting error while compiling my code. I am enclosing a clean code. 
&lt;pre&gt;#include &quot;stdafx.h&quot;
#include 

		using namespace std;


		int Func_Ref_Ptr(int *&amp;pTmpr);

        int Tvalue=6;
		int nValue=9;


		int main()
		{
		
			cout&lt;&lt;&quot;Start of our function:&quot;&lt;&lt;endl;

            //intialize the reference to the pointer to a variable
			int *&amp;pPoint = &amp;Tvalue; 

			cout&lt;&lt;Func_Ref_Ptr(pPoint)&lt;&lt;endl;
		
		   
		 return 0;
		
		}

		int Func_Ref_Ptr(int *&amp;pTmpr)
		   {
		
			   cout&lt;&lt;&quot;The value is :&quot;&lt;&lt;endl;  
		   
		     return *pTmpr;
		   }&lt;/pre&gt;

Please reply me and guide me what i am doing wrong.</description>
		<content:encoded><![CDATA[<p>I have found the problem and it was that i was passing address of a variable in my function call e.g.</p>
<pre> SetToSix(nTvalue)
instead of
SetToSix(pPtr);
 </pre>
<p>However, still i am getting error while compiling my code. I am enclosing a clean code. </p>
<pre>#include "stdafx.h"
#include 

		using namespace std;

		int Func_Ref_Ptr(int *&amp;pTmpr);

        int Tvalue=6;
		int nValue=9;

		int main()
		{

			cout&lt;&lt;&quot;Start of our function:&quot;&lt;&lt;endl;

            //intialize the reference to the pointer to a variable
			int *&amp;pPoint = &Tvalue; 

			cout&lt;&lt;Func_Ref_Ptr(pPoint)&lt;&lt;endl;

		 return 0;

		}

		int Func_Ref_Ptr(int *&amp;pTmpr)
		   {

			   cout&lt;&lt;&quot;The value is :&quot;&lt;&lt;endl;  

		     return *pTmpr;
		   }</pre>
<p>Please reply me and guide me what i am doing wrong.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rebelsoul</title>
		<link>http://www.learncpp.com/cpp-tutorial/74-passing-arguments-by-address/comment-page-1/#comment-92105</link>
		<dc:creator>rebelsoul</dc:creator>
		<pubDate>Wed, 15 Sep 2010 21:35:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/74-passing-arguments-by-address/#comment-92105</guid>
		<description>Hi Alex,

I am having a problem compiling reference to a pointer example code. I am following your code example, however i am getting error while initializing reference to a pointer in main. 
&lt;pre&gt; int * &amp;pPtr = &amp;nTvalue; 

         //function call
         SetToSix(nTvalue);
         
&lt;/pre&gt; 
I am getting following errors on VS 2008
&lt;pre&gt;error C2440: &#039;initializing&#039; : cannot convert from &#039;int *&#039; to &#039;int *&amp;&#039;
 error C2664: &#039;SetToSix&#039; : cannot convert parameter 1 from &#039;int *&#039; to &#039;int *&amp;&#039;
 error C2065: &#039;nSix&#039; : undeclared identifier&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Hi Alex,</p>
<p>I am having a problem compiling reference to a pointer example code. I am following your code example, however i am getting error while initializing reference to a pointer in main. </p>
<pre> int * &amp;pPtr = &amp;nTvalue; 

         //function call
         SetToSix(nTvalue);
</pre>
<p>I am getting following errors on VS 2008</p>
<pre>error C2440: &#39;initializing&#39; : cannot convert from &#39;int *&#39; to &#39;int *&amp;&#39;
 error C2664: &#39;SetToSix&#39; : cannot convert parameter 1 from &#39;int *&#39; to &#39;int *&amp;&#39;
 error C2065: &#39;nSix&#39; : undeclared identifier</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: bla</title>
		<link>http://www.learncpp.com/cpp-tutorial/74-passing-arguments-by-address/comment-page-1/#comment-90203</link>
		<dc:creator>bla</dc:creator>
		<pubDate>Fri, 13 Aug 2010 16:27:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/74-passing-arguments-by-address/#comment-90203</guid>
		<description>I would like to know the answer to your (first) question too. Because s. th. like:
&lt;pre&gt; int nLength= sizeof(pnArray)/sizeof(int); &lt;/pre&gt;
would be nice to make the function PrintArray more elegant as it would only require one parameter:
&lt;pre&gt; void PrintArray(int *pnArray); // why not?? &lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I would like to know the answer to your (first) question too. Because s. th. like:</p>
<pre> int nLength= sizeof(pnArray)/sizeof(int); </pre>
<p>would be nice to make the function PrintArray more elegant as it would only require one parameter:</p>
<pre> void PrintArray(int *pnArray); // why not?? </pre>
]]></content:encoded>
	</item>
</channel>
</rss>

