<?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>enum variables | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/tag/enum-variables/feed/" rel="self" type="application/rss+xml" />
	<link>https://learncgames.com</link>
	<description>A blog about C, programming games and my ebook(s).</description>
	<lastBuildDate>Sun, 27 Sep 2020 10:40:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://learncgames.com/wp-content/uploads/2020/03/cropped-favicon-32x32.png</url>
	<title>enum variables | Learn C Games Programming Blog</title>
	<link>https://learncgames.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">181446779</site>	<item>
		<title>Tutorial 3 on Enum variables published</title>
		<link>https://learncgames.com/tutorial-3-on-enum-variables-published/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tutorial-3-on-enum-variables-published</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Wed, 30 Sep 2020 23:00:00 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[enum variables]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=1513</guid>

					<description><![CDATA[<p>This is the third in a series of C Tutorials that I originally published on about.com between 2006 and 2013.  I&#8217;m republishing them on here. This time it&#8217;s about enum variables. While these aren&#8217;t anywhere as important as say in C++ or other languages (because C&#8217;s type checking is not great!) they make the program [&#8230;]</p>
The post <a href="https://learncgames.com/tutorial-3-on-enum-variables-published/">Tutorial 3 on Enum variables published</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:492,&quot;href&quot;:&quot;https:\/\/pixabay.com\/users\/johnhain-352999\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=4812008&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20251119080635\/https:\/\/pixabay.com\/users\/johnhain-352999\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 15:26:07&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-09 21:29:50&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-23 09:25:39&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-04 20:08:11&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-25 12:55:47&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-14 18:34:43&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-14 18:34:43&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:493,&quot;href&quot;:&quot;https:\/\/pixabay.com\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=4812008&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260205102120\/https:\/\/pixabay.com\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 15:26:10&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-09 21:29:50&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-23 09:25:39&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-04 20:08:11&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-25 12:55:52&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-14 18:34:43&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-14 18:34:43&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;}]'></div>
<figure id="attachment_1514" aria-describedby="caption-attachment-1514" style="width: 300px" class="wp-caption alignleft"><img decoding="async" class="size-medium wp-image-1514" src="https://learncgames.com/wp-content/uploads/2020/09/ones-4812008_640-300x163.jpg" alt="Magic Numbers" width="300" height="163" srcset="https://learncgames.com/wp-content/uploads/2020/09/ones-4812008_640-300x163.jpg 300w, https://learncgames.com/wp-content/uploads/2020/09/ones-4812008_640.jpg 640w" sizes="(max-width: 300px) 100vw, 300px" /><figcaption id="caption-attachment-1514" class="wp-caption-text">Image by <a href="https://pixabay.com/users/johnhain-352999/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=4812008">John Hain</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=4812008">Pixabay</a></figcaption></figure>
<p>This is <a title="Link to C Tutorial on variables" href="https://learncgames.com/tutorial-three-enum-variables/" target="_blank" rel="nofollow noopener noreferrer">the third in a series of C Tutorials</a> that I originally published on about.com between 2006 and 2013.  I&#8217;m republishing them on here. This time it&#8217;s about enum variables. While these aren&#8217;t anywhere as important as say in C++ or other languages (because C&#8217;s type checking is not great!) they make the program more readable.</p>
<p><strong>I see them as banishing magic numbers.</strong> A magic number is a number in a program that is just there. Like when you declare an array and use the number 20. That is a magic number and it would be better if there was a <strong>#define NUMBERMONSTERS 20</strong>.  This avoids the problem of your program being full of 20s until one day you change it to 30 but manage to miss a couple of them and you introduce bugs. By using <strong>NUMBERMONSTERS </strong>everywhere you can change it in just one place (at the #define) and avoid the problem of missing.</p>
<p>Enum variables are similar. Behind the scenes they are just ints. In other programming languages like C++, Pascal, C#, the compiler enforces the enum values. In those languages you can&#8217;t declare an enum variable then assign any int value to it, but in C you can.  But they can at least make your program more readable.</p>
<p><strong>The picture? Magic numbers!</strong></p>The post <a href="https://learncgames.com/tutorial-3-on-enum-variables-published/">Tutorial 3 on Enum variables published</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1513</post-id>	</item>
	</channel>
</rss>
