<?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: 2.1 &#8212; Basic addressing and variable declaration</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/</link>
	<description></description>
	<lastBuildDate>Wed, 08 Sep 2010 10:51:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: AsianBorat</title>
		<link>http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/comment-page-1/#comment-90419</link>
		<dc:creator>AsianBorat</dc:creator>
		<pubDate>Tue, 17 Aug 2010 00:51:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=37#comment-90419</guid>
		<description>YES!!!! This is exactly what I was looking for!  (I was wondering about the &quot;int nValue1, nValue2 = 5; // wrong (nValue1 is uninitialized!)&quot; bit when I was searching for an answer on google)

I also learned a whole lot more about declaring ints than from other tutorials.</description>
		<content:encoded><![CDATA[<p>YES!!!! This is exactly what I was looking for!  (I was wondering about the &#8220;int nValue1, nValue2 = 5; // wrong (nValue1 is uninitialized!)&#8221; bit when I was searching for an answer on google)</p>
<p>I also learned a whole lot more about declaring ints than from other tutorials.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gigith</title>
		<link>http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/comment-page-1/#comment-84307</link>
		<dc:creator>Gigith</dc:creator>
		<pubDate>Sat, 08 May 2010 03:17:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=37#comment-84307</guid>
		<description>&quot;computers have random access memory (RAM) that is available for program to use.&quot;
That should be &quot;programs&quot; or &quot;the program&quot;.</description>
		<content:encoded><![CDATA[<p>&#8220;computers have random access memory (RAM) that is available for program to use.&#8221;<br />
That should be &#8220;programs&#8221; or &#8220;the program&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lilwolf</title>
		<link>http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/comment-page-1/#comment-74718</link>
		<dc:creator>Lilwolf</dc:creator>
		<pubDate>Wed, 23 Dec 2009 09:04:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=37#comment-74718</guid>
		<description>I have a question...

I&#039;m learning Computer Science through a college class, and we were taught to declare variables in the header files under the private section with functions under public...

Why? I&#039;m a little confused and eager to learn, and sadly my professor doesn&#039;t seem to be able to explain things too well. Help please!! :)</description>
		<content:encoded><![CDATA[<p>I have a question&#8230;</p>
<p>I&#8217;m learning Computer Science through a college class, and we were taught to declare variables in the header files under the private section with functions under public&#8230;</p>
<p>Why? I&#8217;m a little confused and eager to learn, and sadly my professor doesn&#8217;t seem to be able to explain things too well. Help please!! :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fluke</title>
		<link>http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/comment-page-1/#comment-73042</link>
		<dc:creator>Fluke</dc:creator>
		<pubDate>Thu, 26 Nov 2009 12:26:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=37#comment-73042</guid>
		<description>Hi Alex,
Great tutorial so far!

A question about declaring variables where they are used.
I am a bit old-style programmer and i cant find the arguments for declare variables when used to be so good. 

Here is my reasoning (proove me wrong, so i can change my style :)
Lets see if we have 1000 lines of code. We have a function of 300 lines somewere inside (among other functions). 
If we use function variables more than once inside that function, and they are declared on their first use, isnt it harder, later on, to find out which one is global and which is declared within those 300 lines?
Or just if we had all function variables just under function name - you can see on first glance which one is there and which one is global?</description>
		<content:encoded><![CDATA[<p>Hi Alex,<br />
Great tutorial so far!</p>
<p>A question about declaring variables where they are used.<br />
I am a bit old-style programmer and i cant find the arguments for declare variables when used to be so good. </p>
<p>Here is my reasoning (proove me wrong, so i can change my style :)<br />
Lets see if we have 1000 lines of code. We have a function of 300 lines somewere inside (among other functions).<br />
If we use function variables more than once inside that function, and they are declared on their first use, isnt it harder, later on, to find out which one is global and which is declared within those 300 lines?<br />
Or just if we had all function variables just under function name &#8211; you can see on first glance which one is there and which one is global?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peak</title>
		<link>http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/comment-page-1/#comment-65292</link>
		<dc:creator>peak</dc:creator>
		<pubDate>Thu, 30 Jul 2009 07:35:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=37#comment-65292</guid>
		<description>Hi, alex. 
can you tell me when I define an int like
&lt;pre&gt;int i;&lt;/pre&gt;
where is the information like the type and the address of i placed?</description>
		<content:encoded><![CDATA[<p>Hi, alex.<br />
can you tell me when I define an int like</p>
<pre>int i;</pre>
<p>where is the information like the type and the address of i placed?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CJ</title>
		<link>http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/comment-page-1/#comment-62780</link>
		<dc:creator>CJ</dc:creator>
		<pubDate>Sun, 21 Jun 2009 06:41:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=37#comment-62780</guid>
		<description>When you say,

&quot;You can also assign them values on the declaration line:
int nValue1 = 5, nValue2 = 6;
int nValue3(7), nValue4(8);

Which is effectively the same as:
int nValue1 = 5;
int nValue2 = 6;
int nValue3 = 7;
int nValue4 = 8;&quot;

Shouldn&#039;t the last two lines be int nValue3(7) and int nValue4(8) because they are supposed to be implicit?</description>
		<content:encoded><![CDATA[<p>When you say,</p>
<p>&#8220;You can also assign them values on the declaration line:<br />
int nValue1 = 5, nValue2 = 6;<br />
int nValue3(7), nValue4(8);</p>
<p>Which is effectively the same as:<br />
int nValue1 = 5;<br />
int nValue2 = 6;<br />
int nValue3 = 7;<br />
int nValue4 = 8;&#8221;</p>
<p>Shouldn&#8217;t the last two lines be int nValue3(7) and int nValue4(8) because they are supposed to be implicit?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/comment-page-1/#comment-59726</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sat, 02 May 2009 03:46:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=37#comment-59726</guid>
		<description>It won&#039;t even compile, so I&#039;m going to go with no. :)  The input variables you use have to be predefined.</description>
		<content:encoded><![CDATA[<p>It won&#8217;t even compile, so I&#8217;m going to go with no. :)  The input variables you use have to be predefined.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bradley</title>
		<link>http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/comment-page-1/#comment-51774</link>
		<dc:creator>Bradley</dc:creator>
		<pubDate>Fri, 20 Mar 2009 03:27:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=37#comment-51774</guid>
		<description>Your second point, that you need to scroll up to find out whether a variable is a local variable or a function parameter is solved simply by following some common sense programming guidelines.  Use prefixes on items to indicate what they are.  For example;

&lt;pre&gt;
//pv prefix means it is a parameter value
//lv prefix means it is a local variable

int add(int pvVal1, int pvVal2)
{
  int lvResult = pvVal1 + pvVal2;
  return lvResult;
}
&lt;/pre&gt;
This method - or something like it - has been the standard at almost every company I have worked with in my 15+ years as a consultant.  This notation, along with the use of meaningful variable names, makes most claims to one method of declaring variables being superior to the other pretty meaningless in my opinion.</description>
		<content:encoded><![CDATA[<p>Your second point, that you need to scroll up to find out whether a variable is a local variable or a function parameter is solved simply by following some common sense programming guidelines.  Use prefixes on items to indicate what they are.  For example;</p>
<pre>
//pv prefix means it is a parameter value
//lv prefix means it is a local variable

int add(int pvVal1, int pvVal2)
{
  int lvResult = pvVal1 + pvVal2;
  return lvResult;
}
</pre>
<p>This method &#8211; or something like it &#8211; has been the standard at almost every company I have worked with in my 15+ years as a consultant.  This notation, along with the use of meaningful variable names, makes most claims to one method of declaring variables being superior to the other pretty meaningless in my opinion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tate</title>
		<link>http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/comment-page-1/#comment-51572</link>
		<dc:creator>Tate</dc:creator>
		<pubDate>Thu, 19 Mar 2009 00:37:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=37#comment-51572</guid>
		<description>Would initializing the intiger x as it is taken from input work? 
e.g. &lt;pre&gt;cin &gt;&gt; int x;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Would initializing the intiger x as it is taken from input work?<br />
e.g.
<pre>cin &gt;&gt; int x;</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/comment-page-1/#comment-48428</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sun, 01 Mar 2009 19:44:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=37#comment-48428</guid>
		<description>Actually if you read closely, I said it was dangerous, not that it wouldn&#039;t compile.  It WILL compile, but x will be uninitialized.  Most new programmers assume that it will be initialized to 5, which is not the case.  That&#039;s why this is particularly dangerous.</description>
		<content:encoded><![CDATA[<p>Actually if you read closely, I said it was dangerous, not that it wouldn&#8217;t compile.  It WILL compile, but x will be uninitialized.  Most new programmers assume that it will be initialized to 5, which is not the case.  That&#8217;s why this is particularly dangerous.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
