How do we use enum keyword to define a variable type in C#?
Answers
Answered by
0
Answer:-The keyword 'enum' is used todeclare new enumeration types in C and C++.
Answered by
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
English,
7 months ago
Social Sciences,
7 months ago
Math,
7 months ago
Computer Science,
1 year ago
English,
1 year ago