<?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>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: Variable sizes and the sizeof operator &#124; 4sharesite</title>
		<link>http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/comment-page-1/#comment-96681</link>
		<dc:creator>Variable sizes and the sizeof operator &#124; 4sharesite</dc:creator>
		<pubDate>Sun, 18 Dec 2011 12:54:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=37#comment-96681</guid>
		<description>[...] by admin on December 18, 2011 in C++ &#183; 0 Comment       As you learned in the lesson on basic addressing, memory on modern machines is typically organized into byte-sized pieces, with each piece having a [...]</description>
		<content:encoded><![CDATA[<p>[...] by admin on December 18, 2011 in C++ &middot; 0 Comment       As you learned in the lesson on basic addressing, memory on modern machines is typically organized into byte-sized pieces, with each piece having a [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kostas81</title>
		<link>http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/comment-page-1/#comment-95904</link>
		<dc:creator>Kostas81</dc:creator>
		<pubDate>Sat, 20 Aug 2011 20:15:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=37#comment-95904</guid>
		<description>Thank you zingmars once again for your answer! (and for the little grammar help ... :) )</description>
		<content:encoded><![CDATA[<p>Thank you zingmars once again for your answer! (and for the little grammar help &#8230; :) )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zingmars</title>
		<link>http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/comment-page-1/#comment-95891</link>
		<dc:creator>zingmars</dc:creator>
		<pubDate>Sat, 20 Aug 2011 15:22:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=37#comment-95891</guid>
		<description>yes, &#039;wrote&#039; is indeed the past tense for &#039;write&#039;. 
Anyway, I guess it depends on the compiler, because mine will pop up a warning in either case. I suppose VS05 did stuff differently.</description>
		<content:encoded><![CDATA[<p>yes, &#8216;wrote&#8217; is indeed the past tense for &#8216;write&#8217;.<br />
Anyway, I guess it depends on the compiler, because mine will pop up a warning in either case. I suppose VS05 did stuff differently.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kostas81</title>
		<link>http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/comment-page-1/#comment-95888</link>
		<dc:creator>Kostas81</dc:creator>
		<pubDate>Sat, 20 Aug 2011 13:59:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=37#comment-95888</guid>
		<description>A quick question:

Alex wrote: &quot;The last mistake is the dangerous case. In this case, the programmer mistakenly tries to initialize both variables by using one assignment statement. 

1  int nValue1, nValue2 = 5; // wrong (nValue1 is uninitialized!)
2	 
3  int nValue1 = 5, nValue2 = 5; // correct

In the top statement, the nValue1 variable will be left uninitialized, and the compiler will NOT complain. This is a great way to have your program intermittently crash and produce sporadic results.&quot;

But in section 1.3, &quot;A first look at variables (and cin)&quot; Alex had wrote:

&quot;A variable that has not been assigned a value is called an uninitialized variable. Uninitialized variables are very dangerous because they cause intermittent problems (due to having different values each time you run the program). This can make them very hard to debug. Most modern compilers WILL print warnings at compile-time if they can detect a variable that is used without being initialized.&quot;

And few lines before he wrote:

&quot;Some newer compilers, such as Visual Studio 2005 Express will pop up a debug error message if you run this program from within the IDE.&quot; (He means a program with an uninitialized variable.)

So, why here the compiler will not complain about the uninitialized variable??? 
(And can someone tell me, &quot;wrote&quot; is the past tense for &quot;write&quot; or not? :D)</description>
		<content:encoded><![CDATA[<p>A quick question:</p>
<p>Alex wrote: &#8220;The last mistake is the dangerous case. In this case, the programmer mistakenly tries to initialize both variables by using one assignment statement. </p>
<p>1  int nValue1, nValue2 = 5; // wrong (nValue1 is uninitialized!)<br />
2<br />
3  int nValue1 = 5, nValue2 = 5; // correct</p>
<p>In the top statement, the nValue1 variable will be left uninitialized, and the compiler will NOT complain. This is a great way to have your program intermittently crash and produce sporadic results.&#8221;</p>
<p>But in section 1.3, &#8220;A first look at variables (and cin)&#8221; Alex had wrote:</p>
<p>&#8220;A variable that has not been assigned a value is called an uninitialized variable. Uninitialized variables are very dangerous because they cause intermittent problems (due to having different values each time you run the program). This can make them very hard to debug. Most modern compilers WILL print warnings at compile-time if they can detect a variable that is used without being initialized.&#8221;</p>
<p>And few lines before he wrote:</p>
<p>&#8220;Some newer compilers, such as Visual Studio 2005 Express will pop up a debug error message if you run this program from within the IDE.&#8221; (He means a program with an uninitialized variable.)</p>
<p>So, why here the compiler will not complain about the uninitialized variable???<br />
(And can someone tell me, &#8220;wrote&#8221; is the past tense for &#8220;write&#8221; or not? :D)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prafull.badyal</title>
		<link>http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/comment-page-1/#comment-95061</link>
		<dc:creator>prafull.badyal</dc:creator>
		<pubDate>Mon, 20 Dec 2010 14:19:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=37#comment-95061</guid>
		<description>gud..thanks to sir alex</description>
		<content:encoded><![CDATA[<p>gud..thanks to sir alex</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shaun</title>
		<link>http://www.learncpp.com/cpp-tutorial/21-basic-addressing-and-variable-declaration/comment-page-1/#comment-92375</link>
		<dc:creator>Shaun</dc:creator>
		<pubDate>Mon, 20 Sep 2010 18:36:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=37#comment-92375</guid>
		<description>so then by making new functions such as:

&lt;pre&gt;
int read( int x, int y)
{
	
	return x + y;
}&lt;/pre&gt;
  is kind of extra work if we can just declare the variables within the Main() function, and get the same output?  for example:
&lt;pre&gt;
int main()
{
	using namespace std;
	int x;
	cout &lt;&lt; &quot;enter first number here&quot; &lt;&lt; endl;
	cin &gt;&gt; x;
	int y;
	cout &lt;&lt; &quot;enter second number here&quot; &lt;&lt; endl;
	cin &gt;&gt; y;
	cout &lt;&lt; x + y &lt;&lt; endl;
	return 0;
}&lt;/pre&gt;  this doesnt require any other functions to add 2 numbers from a user and give a result.  but in the chapter 1 comprehension quiz we needed 2 functions to do what this single Main() function can do without the hassle.  am i missing something? or does this seem so much easier?  or maybe that&#039;s why you made this more clear in the next chapter?  just want to note, i do understand making a function to do this for us is beneficial for multiple addition problems, but for a single one, i find this is much simpler.</description>
		<content:encoded><![CDATA[<p>so then by making new functions such as:</p>
<pre>
int read( int x, int y)
{

	return x + y;
}</pre>
<p>  is kind of extra work if we can just declare the variables within the Main() function, and get the same output?  for example:</p>
<pre>
int main()
{
	using namespace std;
	int x;
	cout &lt;&lt; &quot;enter first number here&quot; &lt;&lt; endl;
	cin &gt;&gt; x;
	int y;
	cout &lt;&lt; &quot;enter second number here&quot; &lt;&lt; endl;
	cin &gt;&gt; y;
	cout &lt;&lt; x + y &lt;&lt; endl;
	return 0;
}</pre>
<p>  this doesnt require any other functions to add 2 numbers from a user and give a result.  but in the chapter 1 comprehension quiz we needed 2 functions to do what this single Main() function can do without the hassle.  am i missing something? or does this seem so much easier?  or maybe that&#8217;s why you made this more clear in the next chapter?  just want to note, i do understand making a function to do this for us is beneficial for multiple addition problems, but for a single one, i find this is much simpler.</p>
]]></content:encoded>
	</item>
	<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>
</channel>
</rss>

