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/Lectures/LC19/Enum/enum.c

24 lines
512 B
C
Raw Normal View History

2022-04-07 15:58:01 +00:00
#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;
}