<?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>example code | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/example-code/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Mon, 02 Jan 2012 13:00:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>How to use Enum in C?</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c-faq/enum/</link>
					<comments>https://studentprojects.in/software-development/c-tutorials/c-faq/enum/#respond</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Mon, 02 Jan 2012 12:59:23 +0000</pubDate>
				<category><![CDATA[C Questions & Answers]]></category>
		<category><![CDATA[enum]]></category>
		<category><![CDATA[how to use]]></category>
		<category><![CDATA[enumeration]]></category>
		<category><![CDATA[example code]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=2522</guid>

					<description><![CDATA[<p>In C and C++, enum types can be used to set up collections of named integer constants. Consider a set of all days. #define Sunday 0 #define Monday 1 #define Tuesday 2 #define Wednesday 3 #define Thursday 4 #define Friday 5 #define Saturday 6 The above lines can be replaced by: enum AllDays{Sunday, Monday, Tuesday,</p>
<p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c-faq/enum/">How to use Enum in C?</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>In C and C++, enum types can be used to set up collections of named integer constants. Consider a set of all days. </p>
<p>#define Sunday  	 0<br />
#define Monday	 1<br />
#define Tuesday 	 2<br />
#define Wednesday 3<br />
#define Thursday	 4<br />
#define Friday  5<br />
#define Saturday	 6</p>
<p>The above lines can be replaced by:</p>
<pre lang="c" line="1">
enum AllDays{Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday};
</pre>
<p><strong>Example program:</strong></p>
<pre lang="c" line="1">
#include "stdio.h" 
int main()
{
	enum AllDays{Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday};

	AllDays aDay;
	int i = 0;
	printf("Please enter the day of the week (0 to 6)\n");
	scanf("%d",&i);
	aDay = AllDays(i);

	if(aDay == Sunday || aDay == Saturday)
	printf("It is weekend :) \n");
	else
	printf("It is not weekend :( \n");

	return 0;
}
</pre><p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c-faq/enum/">How to use Enum in C?</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/c-tutorials/c-faq/enum/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
