Jun 122012
 C Tags:  Add comments

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;


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.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>