<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>C++ Tutorial - Structures</title><link>/technologies/code_exchange/b/blog/posts/c-tutorial---structures</link><description>IntroductionIn the previous tutorial , we talked about arrays, which allow you to store many related values of the same data type. In this tutorial, we are going to talk about structures, which allow you to store related values of different data...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: C++ Tutorial - Structures</title><link>https://community.element14.com/technologies/code_exchange/b/blog/posts/c-tutorial---structures</link><pubDate>Thu, 02 Apr 2015 06:57:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:142aa239-6d26-4e0c-9244-04827cea9051</guid><dc:creator>Former Member</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Well, I found the problem with the code here, which had a problem both with GCC on Raspbian and on Visual Studio 2013 on Windows 7. The problem is: _TCHAR* is not declared. The solution is to replace:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;int _tmain(int argc, _TCHAR* argv[])&lt;br /&gt;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp; cout.setf(ios::fixed, ios::floatfield);&lt;br /&gt;&amp;nbsp;&amp;nbsp; cout.precision(2);&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;with:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;int main()&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=14771&amp;AppID=74&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: C++ Tutorial - Structures</title><link>https://community.element14.com/technologies/code_exchange/b/blog/posts/c-tutorial---structures</link><pubDate>Tue, 31 Mar 2015 16:09:29 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:142aa239-6d26-4e0c-9244-04827cea9051</guid><dc:creator>Former Member</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;span&gt;09_FruitWars.cpp does not compile. Fix please.&lt;/span&gt;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=14771&amp;AppID=74&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: C++ Tutorial - Structures</title><link>https://community.element14.com/technologies/code_exchange/b/blog/posts/c-tutorial---structures</link><pubDate>Wed, 27 Feb 2013 12:38:18 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:142aa239-6d26-4e0c-9244-04827cea9051</guid><dc:creator>shabaz</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Good stuff. Just a very minor comment, it is good to use typedef when declaring a struct. Usually (99.99% of the time) it doesn&amp;#39;t matter, but it makes it absolutely clear to the compiler that in future you wish to refer to the struct without using the word &amp;#39;struct&amp;#39; (because the possibility exists that the compiler will get confused if you declare other things with the same name). This is more familiar to C users (a C compiler would complain about this), but a C++ compiler won&amp;#39;t complain, and assume you know what you intended here. So, something like&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;typedef struct Inventory_s&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;&amp;nbsp; //etc..&lt;/p&gt;&lt;p&gt;} Inventory; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;(Strictly speaking no need for appending the &amp;#39;_s&amp;#39;, this is just a habit for me to make it easier to read. Others don&amp;#39;t do that).&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Very minor as mentioned earlier. Automatically inserting it is good, since it gets people in the habit. I&amp;#39;m just used to always seeing struct preceeded with typedef.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=14771&amp;AppID=74&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>