<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Talk Binary &#187; Struct</title>
	<atom:link href="http://talkbinary.com/tag/struct/feed/" rel="self" type="application/rss+xml" />
	<link>http://talkbinary.com</link>
	<description>Programming Resources, Technology, Computers</description>
	<lastBuildDate>Mon, 06 Feb 2012 17:01:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Structs in C++</title>
		<link>http://talkbinary.com/programming/c/structs-in-c/</link>
		<comments>http://talkbinary.com/programming/c/structs-in-c/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 04:41:16 +0000</pubDate>
		<dc:creator>Diego</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[assign]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[data type]]></category>
		<category><![CDATA[declare]]></category>
		<category><![CDATA[define]]></category>
		<category><![CDATA[Struct]]></category>
		<category><![CDATA[Structs]]></category>

		<guid isPermaLink="false">http://talkbinary.com/?p=1615</guid>
		<description><![CDATA[Overview of Structs Structs allow to combine multiple data types as a single data type. Access to these data types within the structs are done through the fields (members) name. Structs become useful when you need to create a data type that you will use multiple times, requires multiple data types to define it and<a class="moretag" href="http://talkbinary.com/programming/c/structs-in-c/">&#160;&#160;Full Article&#8230;</a>
]]></description>
			<content:encoded><![CDATA[<h3 id="section-1">Overview of Structs</h3>
<p>Structs allow to combine multiple data types as a single data type. Access to these data types within the structs are done through the fields (members) name.</p>
<p>Structs become useful when you need to create a data type that you will use multiple times, requires multiple data types to define it and requires no additional functionality such as what is found in classes.</p>
<h3 id="section-2">Example of a Struct</h3>
<p>In general, a Struct defines a new data type. Below is an example of a Student.</p>
<pre lang="c++">struct Student {
	string name;
	int sid;
	string ssn;
};</pre>
<p><br/>Below is an example of how to create a student, assign values to its members and how to access them as well.<br />
<span id="more-1615"></span></p>
<pre lang="c++">Student fred;

fred.name = "Fred";
fred.sid = 86088121;
fred.ssn = "123-20-2345";

cout << "Student: " << fred.name << endl << "Sid: " << fred.sid
              << endl << "SSN: " << fred.ssn << endl;
</pre>
<p><br/>The output of the above code is as below </p>
<pre lang="c++">Student: Fred
Sid: 86088121
SSN: 123-20-2345
</pre>
<h3 id="section-3">Summary</h3>
<p>The previous Struct was declared before the main declaration of a C++ program. As you may have noticed it proves useful when a new data type needs to be defined.  </p>
]]></content:encoded>
			<wfw:commentRss>http://talkbinary.com/programming/c/structs-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced

Served from: talkbinary.com @ 2012-02-11 13:33:08 -->
