This repository has been archived on 2023-10-26. You can view files and clone it, but cannot push or open issues or pull requests.
VSMechatronics/LC19/enum.c
2022-04-07 16:58:01 +01:00

24 lines
512 B
C

#include <stdio.h>
#include <stdlib.h>
int main(void)
{
/* Set up our enumerated type */
enum Days { Mon, Tue, Wed, Thu, Fri, Sat, Sun };
/* If we wish, we can set the base level */
//enum Days { Mon = 1 , Tue, Wed, Thu, Fri, Sat, Sun };
/* Create a variable that can take values of this type */
enum Days DOW;
/* Set variable equal to one of these days */
DOW = Sun;
/* And print the assigned value */
printf ("\nThe value assigned to Sun is %d ",DOW);
return 0;
}