<?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>Codec &#187; struct</title>
	<atom:link href="http://www.trembl.org/codec/tag/struct/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.trembl.org/codec</link>
	<description>A Personal Polylogic Code/Decode &#039;Zettelkasten&#039;</description>
	<lastBuildDate>Thu, 02 Feb 2012 03:38:01 +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>Typedef, Struct, Enum</title>
		<link>http://www.trembl.org/codec/107/</link>
		<comments>http://www.trembl.org/codec/107/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 07:05:15 +0000</pubDate>
		<dc:creator>Georg Tremmel</dc:creator>
				<category><![CDATA[Raw]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[enum]]></category>
		<category><![CDATA[struct]]></category>
		<category><![CDATA[typedef]]></category>

		<guid isPermaLink="false">http://www.trembl.org/codec/?p=107</guid>
		<description><![CDATA[struct a collection of types, composite data type, composition, &#8220;user-definded data structure&#8221; struct Test { char* name; int nr; float f; }; Name of type is &#8220;struct Test&#8221;, and not &#8220;Test&#8221; alone. struct Test myNewTest Semicolon after closing parethesis is essentional. Access composed types with dot-syntax: myNewTest.name = "hjkjnk"; myNewTest.nr = 32; myNewTest.f = 2.2424; [...]]]></description>
			<content:encoded><![CDATA[<p><strong>struct</strong><br />
a collection of types, composite data type, composition, <em>&#8220;user-definded data structure&#8221;</em><br />
<code>struct Test {<br />
    char* name;<br />
    int nr;<br />
    float f;<br />
};</code></p>
<p>Name of type is &#8220;struct Test&#8221;, and not &#8220;Test&#8221; alone.<br />
<code>struct Test myNewTest</code></p>
<p>Semicolon after closing parethesis is essentional.</p>
<p>Access composed types with dot-syntax:<br />
<code>myNewTest.name = "hjkjnk";<br />
myNewTest.nr = 32;<br />
myNewTest.f = 2.2424</code>;</p>
<p><strong>typedef</strong><br />
a shorthand, an alias for a type, for ease of readability.</p>
<p><code>typedef int MyType</code></p>
<p>&#8220;MyType n;&#8221; would be equal to &#8220;int n;&#8221;</p>
<p><strong>enum</strong><br />
&#8220;introduces a symbolic name for an integer constant&#8221;</p>
<p>enum direction_enum {LEFT, RIGHT};<br />
/* LEFT -> 0, RIGHT -> 1; */<br />
enum direction_enum x = LEFT;</p>
<p><strong>typedef enum<br />
</strong><br />
<code>typedef enum {<br />
    LEFT;<br />
    RIGHT;<br />
} direction;<br />
</code><br />
<em>declatation:</em><br />
-(void)myFunction:(direction)LEFTorRIGHT;</p>
<p><em>call:</em><br />
-(void)myFunction:LEFT;</p>
<p><strong>typedef struct</strong></p>
<p>typedef struct objectInfo_ {<br />
    CGPoint origin;<br />
    NSString* name;<br />
    NSColor* color;<br />
} objectInfo</p>
<p>Shortcut. Instead of writing &#8216;struct objectInfo_&#8217;, write &#8216;objectInfo&#8217;. The keyword &#8216;objectInfo_&#8217; seems to be optional.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trembl.org/codec/107/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

