<?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.7 &#8212; Chars</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/27-chars/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/27-chars/</link>
	<description></description>
	<lastBuildDate>Thu, 02 Feb 2012 21:20:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: XxKarmaxX</title>
		<link>http://www.learncpp.com/cpp-tutorial/27-chars/comment-page-1/#comment-96552</link>
		<dc:creator>XxKarmaxX</dc:creator>
		<pubDate>Mon, 05 Dec 2011 15:14:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=48#comment-96552</guid>
		<description>If this function were to run properly, shouldn&#039;t it return an integer at the end?

#include &quot;iostream&quot;;
 
int main()
{
    using namespace std;
    char chChar;
    cout &lt;&gt; chChar;
    cout &lt;&lt; chChar &lt;&lt; &quot; has ASCII code &quot; &lt;&lt; (int)chChar &lt;&lt; endl;
}</description>
		<content:encoded><![CDATA[<p>If this function were to run properly, shouldn&#8217;t it return an integer at the end?</p>
<p>#include &#8220;iostream&#8221;;</p>
<p>int main()<br />
{<br />
    using namespace std;<br />
    char chChar;<br />
    cout &lt;&gt; chChar;<br />
    cout &lt;&lt; chChar &lt;&lt; &quot; has ASCII code &quot; &lt;&lt; (int)chChar &lt;&lt; endl;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zingmars</title>
		<link>http://www.learncpp.com/cpp-tutorial/27-chars/comment-page-1/#comment-95951</link>
		<dc:creator>zingmars</dc:creator>
		<pubDate>Thu, 01 Sep 2011 08:48:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=48#comment-95951</guid>
		<description>You answered your own question - it stores 53, because as you said, it stores the ASCII code. when you add the (int), nothing changes, because cchar2 already has an int in it (53), hence it still thinks of it as 53.</description>
		<content:encoded><![CDATA[<p>You answered your own question &#8211; it stores 53, because as you said, it stores the ASCII code. when you add the (int), nothing changes, because cchar2 already has an int in it (53), hence it still thinks of it as 53.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lan</title>
		<link>http://www.learncpp.com/cpp-tutorial/27-chars/comment-page-1/#comment-95942</link>
		<dc:creator>lan</dc:creator>
		<pubDate>Sat, 27 Aug 2011 19:21:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=48#comment-95942</guid>
		<description>Please i need some help here.
For example on these lines of code 

char = cchar;
cin&gt;&gt; cchar;

if i input 10 at cchar it stores 10 as a string or as an integer?

i made the code below to make a test in order to get the
answer on the question that is above


	char cchar;
	cin&gt;&gt;cchar;
	char cchar2 = 5;
	cout&lt;&lt;cchar+cchar2&lt;&lt;endl;
	cout&lt;&lt;cchar+(int)cchar2;

i input 5 and it gives me a sum of 58
on both couts, this make me understand that it takes
the input of cchar as string because as you said in the tutorial:
char chValue = &#039;5&#039;; // assigns 53 (ASCII code for &#039;5&#039;)
but i cant understand why at the second cout it takes (int)cchar2  as 53 shouldnt it have the value of 5 because of the (int).
Please an answer would be appreciated.</description>
		<content:encoded><![CDATA[<p>Please i need some help here.<br />
For example on these lines of code </p>
<p>char = cchar;<br />
cin&gt;&gt; cchar;</p>
<p>if i input 10 at cchar it stores 10 as a string or as an integer?</p>
<p>i made the code below to make a test in order to get the<br />
answer on the question that is above</p>
<p>	char cchar;<br />
	cin&gt;&gt;cchar;<br />
	char cchar2 = 5;<br />
	cout&lt;&lt;cchar+cchar2&lt;&lt;endl;<br />
	cout&lt;&lt;cchar+(int)cchar2;</p>
<p>i input 5 and it gives me a sum of 58<br />
on both couts, this make me understand that it takes<br />
the input of cchar as string because as you said in the tutorial:<br />
char chValue = &#039;5&#039;; // assigns 53 (ASCII code for &#039;5&#039;)<br />
but i cant understand why at the second cout it takes (int)cchar2  as 53 shouldnt it have the value of 5 because of the (int).<br />
Please an answer would be appreciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zingmars</title>
		<link>http://www.learncpp.com/cpp-tutorial/27-chars/comment-page-1/#comment-95898</link>
		<dc:creator>zingmars</dc:creator>
		<pubDate>Sat, 20 Aug 2011 15:41:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=48#comment-95898</guid>
		<description>You just remember them naturally after using them dozen of times. Also, there&#039;s always google, should you forget any of them :p</description>
		<content:encoded><![CDATA[<p>You just remember them naturally after using them dozen of times. Also, there&#8217;s always google, should you forget any of them :p</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jupi</title>
		<link>http://www.learncpp.com/cpp-tutorial/27-chars/comment-page-1/#comment-95862</link>
		<dc:creator>Jupi</dc:creator>
		<pubDate>Mon, 15 Aug 2011 01:54:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=48#comment-95862</guid>
		<description>Do programmers have to memorize escape sequences and stuff? It would be helpful if there was a single page with all the reference tables in it.. I&#039;ll just bookmark &#039;em for now (;</description>
		<content:encoded><![CDATA[<p>Do programmers have to memorize escape sequences and stuff? It would be helpful if there was a single page with all the reference tables in it.. I&#8217;ll just bookmark &#8216;em for now (;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zingmars</title>
		<link>http://www.learncpp.com/cpp-tutorial/27-chars/comment-page-1/#comment-95666</link>
		<dc:creator>zingmars</dc:creator>
		<pubDate>Wed, 06 Jul 2011 13:50:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=48#comment-95666</guid>
		<description>Yeah, he made a mistake there, and hasn&#039;t fixed it.</description>
		<content:encoded><![CDATA[<p>Yeah, he made a mistake there, and hasn&#8217;t fixed it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cdoimne</title>
		<link>http://www.learncpp.com/cpp-tutorial/27-chars/comment-page-1/#comment-95664</link>
		<dc:creator>Cdoimne</dc:creator>
		<pubDate>Wed, 06 Jul 2011 00:17:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=48#comment-95664</guid>
		<description>How come on one of the codes above it says 

#include &quot;iostream&quot;; ?

 Shouldn&#039;t it be 

#include  ?

Just saying.</description>
		<content:encoded><![CDATA[<p>How come on one of the codes above it says </p>
<p>#include &#8220;iostream&#8221;; ?</p>
<p> Shouldn&#8217;t it be </p>
<p>#include  ?</p>
<p>Just saying.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jsieckman</title>
		<link>http://www.learncpp.com/cpp-tutorial/27-chars/comment-page-1/#comment-95078</link>
		<dc:creator>jsieckman</dc:creator>
		<pubDate>Tue, 28 Dec 2010 04:56:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=48#comment-95078</guid>
		<description>In the following example above:

char chValue = &#039;5&#039;; // assigns 53 (ASCII code for &#039;5&#039;)
char chValue2 = 5; // assigns 5

Does the bottom statement assign 5 or does it assign the character associated with the ASCII code for 5 (i.e. a club symbol)?

Thanks</description>
		<content:encoded><![CDATA[<p>In the following example above:</p>
<p>char chValue = &#8217;5&#8242;; // assigns 53 (ASCII code for &#8217;5&#8242;)<br />
char chValue2 = 5; // assigns 5</p>
<p>Does the bottom statement assign 5 or does it assign the character associated with the ASCII code for 5 (i.e. a club symbol)?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PReinie</title>
		<link>http://www.learncpp.com/cpp-tutorial/27-chars/comment-page-1/#comment-94899</link>
		<dc:creator>PReinie</dc:creator>
		<pubDate>Tue, 09 Nov 2010 23:52:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=48#comment-94899</guid>
		<description>Using [] declares the variable as an array of characters. An array is different than a string and is different than one character... but each element of the array is one character. Unlike a string, the array is not terminated by a zero (null), unless you put one there.

If you compare each element of the array one for one (zero to zero, one to one and two to two) each element will give &#039;1&#039; for the match. In my tests, I made each array larger: 
={&#039;s&#039;, &#039;i&#039;, &#039;n&#039;, &#039;s&#039;}; and if you compare sss[0] to ddd[0] or sss[0] to ddd[3] they match. 

To compare strings you will have to use a string-compare function. (I haven&#039;t gotten that far yet. Just recalling unix shell and C code from my past.</description>
		<content:encoded><![CDATA[<p>Using [] declares the variable as an array of characters. An array is different than a string and is different than one character&#8230; but each element of the array is one character. Unlike a string, the array is not terminated by a zero (null), unless you put one there.</p>
<p>If you compare each element of the array one for one (zero to zero, one to one and two to two) each element will give &#8217;1&#8242; for the match. In my tests, I made each array larger:<br />
={&#8216;s&#8217;, &#8216;i&#8217;, &#8216;n&#8217;, &#8216;s&#8217;}; and if you compare sss[0] to ddd[0] or sss[0] to ddd[3] they match. </p>
<p>To compare strings you will have to use a string-compare function. (I haven&#8217;t gotten that far yet. Just recalling unix shell and C code from my past.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PReinie</title>
		<link>http://www.learncpp.com/cpp-tutorial/27-chars/comment-page-1/#comment-94864</link>
		<dc:creator>PReinie</dc:creator>
		<pubDate>Thu, 04 Nov 2010 19:39:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=48#comment-94864</guid>
		<description>Oh yeah, you need the comparison == for the if.</description>
		<content:encoded><![CDATA[<p>Oh yeah, you need the comparison == for the if.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

