summaryrefslogtreecommitdiff
path: root/reference/C/EXAMPLES/enum5.c
diff options
context:
space:
mode:
Diffstat (limited to 'reference/C/EXAMPLES/enum5.c')
-rw-r--r--reference/C/EXAMPLES/enum5.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/reference/C/EXAMPLES/enum5.c b/reference/C/EXAMPLES/enum5.c
new file mode 100644
index 0000000..76f52f2
--- /dev/null
+++ b/reference/C/EXAMPLES/enum5.c
@@ -0,0 +1,27 @@
+/****************************************************************************
+ *
+ * Enumeration example: This program will compile but the #define statement
+ * will cause FALSE and TRUE to have a value of 1
+ *
+ ****************************************************************************/
+
+enum Boolian_t {FALSE=0, TRUE} Boolian;
+
+#define FALSE 1
+
+main()
+{
+
+ enum Boolian_t Boolian;
+
+ printf("False has a value of %d\n", FALSE);
+ printf(" True has a value of %d\n", TRUE);
+}
+/****************************************************************************
+ *
+ * Results:
+ *
+ * False has a value of 1
+ * True has a value of 1
+ *
+ ****************************************************************************/