C Program Output

What will be the output of the below C language program:
int main()
{
    enum os {windows, unix, mac};
    enum furnitures {doors, windows, table, chair, bed};
    for(int i=doors; i<bed; i++)
    printf("%d ", i);
    return 0;
}

Solution:

Result: ERROR !

In the given program, enumeration constant windows is defined twice, once in os and then in furnitures. An enumeration constant can only be defined once.

It cannot be repeated across enumerations.

0 Comments

Leave a comment