Computer Science, asked by Rajat7392, 1 year ago

How do we use enum keyword to define a variable type in C#?

Answers

Answered by khushi769
0
Answer:-The keyword 'enum' is used todeclare new enumeration types in C and C++.
Answered by KomalSrinivas
0

The enum keyword in C is used to assign a name to an integral constant in a program. using this we can make the program more easy to understand.

We can use this to give numeric values to variables in the following way-

enum flag {const1, const2, const3}

by default, the value of variables will be 0,1,2, and so on.

if you want to assign different values then use it this way -

enum Suit {

enum Suit { club=10,

enum Suit { club=10, spade= 20,

enum Suit { club=10, spade= 20, };

Similar questions