PROGRAM FOR ENUMS
PROGRAM FOR ENUMS
#include <stdio.h>
#include <stdlib.h>
int main()
return 0;
This program demonstrates the use of enums in C. Enums, short for enumerations, allow you to define a set of
named integral constants. In this program, an enum type called `Company` is defined with several constants
representing different companies.
1. **Include Statements**:
```c
#include <stdio.h>
#include <stdlib.h>
```
These are include statements to include the standard input/output and standard library header files.
2. **Enum Declaration**:
```c
```
This declares an enumeration type `Company` with the constants `GOOGLE`, `FACEBOOK`, `XEROX`, `YAHHOO`,
`EBAY`, and `MICROSOFT`. By default, these constants are assigned integral values starting from 0 and incrementing
by 1 for each subsequent constant (i.e., `GOOGLE` is 0, `FACEBOOK` is 1, and so on).
3. **Main Function**:
```c
int main()
return 0;
```
- Three variables `xerox`, `google`, and `ebay` are declared of type `enum Company`, and they are assigned values
from the `Company` enum constants `XEROX`, `GOOGLE`, and `EBAY`, respectively.
- Then, the program prints out the integral values of these variables using `printf()`.
4. **Output**:
```
```
These values correspond to the integral values assigned to the enum constants `XEROX`, `GOOGLE`, and `EBAY`,
respectively.