Added book examples

This commit is contained in:
Louise Brown
2022-04-08 16:12:38 +01:00
parent 5b205092a7
commit 1c0a9e7b6a
59 changed files with 1381 additions and 0 deletions

22
C19/enum_example.c Normal file
View File

@@ -0,0 +1,22 @@
#include <stdio.h>
#include <stdlib.h>
enum DOW { sun, mon, tue, wed, thu, fri, sat } ;
// Main () - execution starts here
int main (void)
{
enum DOW day;
/* Code that get a value for 'day' */
day = tue;
switch (day)
{
case sun : printf ("Sunday\n") ; break ;
case mon : printf ("Monday\n") ; break ;
case tue : printf ("Tuesday\n") ; break ;
/* etc. */
}
return (0); // Exit indicating success
}